Notification Center

RSS for tag

Create and manage app extensions that implement Today widgets using Notification Center.

Posts under Notification Center tag

70 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

Request authorization for the notification center crash iOS app on Swift 6
Hey all! During the migration of a production app to swift 6, I've encountered a problem: when hitting the UNUserNotificationCenter.current().requestAuthorization the app crashes. If I switch back to Language Version 5 the app works as expected. The offending code is defined here class AppDelegate: NSObject, UIApplicationDelegate { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { FirebaseApp.configure() FirebaseConfiguration.shared.setLoggerLevel(.min) UNUserNotificationCenter.current().delegate = self let authOptions: UNAuthorizationOptions = [.alert, .badge, .sound] UNUserNotificationCenter.current().requestAuthorization(options: authOptions) { _, _ in } application.registerForRemoteNotifications() Messaging.messaging().delegate = self return true } } The error is depicted here: I have no idea how to fix this. Any help will be really appreciated thanks in advance
4
0
165
4d
Post Notification to RCP but Timeline won't fire
I am trying to use onNofitication in BehaviorComponent to fire up my composed timeline actions. Which is formed up by one TransformTo action, one Hide action and followed by a Notification action indicating the other two actions are finished. With this post, I successfully send a notification to RCP to fire up my timeline with identification: NotificationCenter.default.post( name: NSNotification.Name("RealityKit.NotificationTrigger"), object: nil, userInfo: [ "RealityKit.NotificationTrigger.Scene": scene, "RealityKit.NotificationTrigger.Identifier": "onSomethingStart" ] ) On the other hand, to subscribe that Notification Action, I append a onReceive function below my RealityView, and succesfully received my notification private let notificationTrigger = NotificationCenter.default.publisher( for: Notification.Name("RealityKit.NotificationTrigger")) guard let entity = out.userInfo?["RealityKit.NotificationTrigger.SourceEntity"] as? Entity, let notificationName = out.userInfo?["RealityKit.NotificationTrigger.Identifier"] as? String else { return } debugPrint("Received notification: \(notificationName), entity name: \(entity.name)") Which means that my Timeline is fired up because I can received my notification in my Timeline. But the rest two actions just don't appear to be working. I played the timeline in RCP it works fine. Anything I missed to make it tick? XCode beta 16.1 VisionOS beta 9
2
0
287
3w
The notification is invalid
I can execute an action by allowing Xcode to send a notification to Reality Composer Pro via NotificationCenter, or I can send notifications to Xcode through the Notification Action in Reality Composer Pro. However, I discovered that they were unable to accept notifications from both parties within my project. To ascertain whether there was an error in my code, I created a simple Demo project. I utilized the same code and determined that it functioned normally within the Demo project. It is perplexing that I am unable to resolve this issue. Do I require additional modifications?
1
0
282
Aug ’24
Can TodayExtensions and WidgetKit Coexist in an App
I understand that TodayExtension will be deprecated in iOS 18, and we have integrated WidgetKit into our app. However, we have encountered some issues during the app update process. Specifically, we noticed that the TodayExtension might not appear in the tools list or sometimes the TodayExtension appear "Unable to Load" Could you please advise on the possible causes of this issue? Is there a way to resolve it if we want to keep both types of widgets active?
3
0
570
Aug ’24
Rich-push notifications
For notifications, I am using a firebase api [cloud messaging ]. I am getting normal notifications in all app states. when I try notifications with the attached image URL, in the foreground the image is displayed and it working properly but when the application is in a background state or terminated the normal text notification is getting without image. I also tried using the ns-notifications service and contents.
1
0
199
Aug ’24
Opening parent app from Widget upon Push Notification
Good afternoon! I am working on an app which requires the app to be opened in response to a push notification from a background state. As it stands: The app is running in the background The app has a static widget on the homepage The app has a dynamic widget with a live activity which is being updated from the backend The dynamic widget is firing an event which the static widget is listening for The static widget is programatically calling an AppIntent which tries to open the parent app Is this possible? Is there a better approach which would work? We are looking for a way to open the app from the background with the users permission. Appreciate any guidance on the issue
0
0
235
Aug ’24
LiveActivity not starting - error: target does not include NSSupportsLiveActivities plist key
I'm trying to start a live activity that allows a user to see and control a recording from their lock screen. I have an AppIntent that uses a class to start recording the user. The intent is used in a home screen widget. Upon pressing the button in the widget, the intent is called, which then calls the startRecording function within its perform. This function then tries to start the live activity, but it is currently failing with a "Failed to start live activity: The operation couldn’t be completed. Target does not include NSSupportsLiveActivities plist key" error. The relevant code block is this: func startRecording() { print("[RecordingManager] start recording called") isRecording = true let activityAttributes = RecordingControlWidgetAttributes(name: "RecordingManagerActivity") let initialContentState = RecordingControlWidgetAttributes.ContentState(isRecording: true, startTime: Date()) let initialContent = ActivityContent(state: initialContentState, staleDate: nil) if ActivityAuthorizationInfo().areActivitiesEnabled { do { liveActivity = try Activity<RecordingControlWidgetAttributes>.request( attributes: activityAttributes, content: initialContent, pushType: nil ) } catch { print("Failed to start live activity: \(error.localizedDescription)") } } else { print("Live activities are not available") } // TODO: actually start the recording } When this function is run/the button is pressed, the following messages are printed: "[RecordingManager] start recording called Failed to start live activity: The operation couldn’t be completed. Target does not include NSSupportsLiveActivities plist key" However, I have included the NSSupportsLiveActivities key, with value YES, in the target Info in XCode for both the main app target and the WidgetExtension. The following line exists in both the Release and Debug parts of the project.pbxproj file: INFOPLIST_KEY_NSSupportsLiveActivities = YES; I also tried including this key and value directly in the Info.plist file of both targets, but that also didn't work. This issue is occurring both on device and in simulator. I also checked that both my device and the simulator has LiveActivities turned on in Settings for the app. What could be going wrong? Are there any other situations where this error may print?
0
1
358
Jul ’24
Not getting notifications from some apps on iOS 17.5.1
Tried all these steps Force restart DIsabled focus mode Notifications are enabled in both device and in app settings Disabled summary notifications. Tried sending notification from pusher tool, that also is not showing up in the center, for the device effected but on another device it is working fine for the same application(same version too) What could be the reason and a possible solution?
2
0
359
Jul ’24
Custom Notification Sounds Not Updating Without System Restart on macOS
I'm a macOS app developer, and I'm facing an issue with custom notification sounds in my app. After upgrading the app to include new custom notification sounds, the changes do not reflect until the system is restarted. The sounds do not update immediately after the app upgrade. Is there a way to refresh or reload the custom notification sounds without needing a full system restart? Any guidance or best practices to handle this would be greatly appreciated. Thank you!
0
0
258
Jul ’24
Custom Notification Sounds Not Updating Without System Restart on macOS
Hello, I'm a macOS app developer, and I'm facing an issue with custom notification sounds in my app. After upgrading the app to include new custom notification sounds, the changes do not reflect until the system is restarted. The sounds do not update immediately after the app upgrade. Is there a way to refresh or reload the custom notification sounds without needing a full system restart? Any guidance or best practices to handle this would be greatly appreciated. Thank you!
0
0
250
Jul ’24
Set up-to-date badge count when using UNNotificationRequest with trigger
hi, I am trying to schedule a UNNotificationRequest at a certain date using UNCalendarNotificationTrigger, and I also want to update the badge count accordingly. However the badge property in UNNotificationContent can only be set when adding UNNotificationRequest, not when the trigger is fired or notification is actually delivered. How can I set up-to-date badge count if notification is scheduled in the future? For example, if I scheduled notification A to 3 hours later with badge count 1, and in between I got notification B, badge count should be 2 when A is delivered but it will be 1. I am aware of didPresent delegate which can be used when app is in foreground when notification is delivered, but is there any delegate that is called when UNNotificationRequest is delivered and app is backgrounded or we are using NSE? Thanks.
1
0
319
Jul ’24
Potential Apple Pay Notification Delay in iOS 18 Developer Beta
Potential Apple Pay Notification Delay in iOS 18 Developer Beta Users are reporting a delay in receiving purchase notifications in Apple Wallet after using Apple Pay. Transactions are confirmed within the Wallet app, but the notification arrives hours later. As this issue is occurring on the iOS 18 developer beta, it's likely a software bug related to Apple Pay integration with Wallet. I have reported this to Feedback. Is anyone else having the same problem?
2
1
755
Jun ’24
Difference in behavior between setBadgeCount and applicationIconBadgeNumber
Hi, I have a question regarding the badge in push notifications. I am implementing the following code to set the badge to 0 in order to remove it from the app: swift if #available(iOS 16, *) { let center = UNUserNotificationCenter.current() center.setBadgeCount(0) } else { application.applicationIconBadgeNumber = 0 } When I call setBadgeCount(0), the badge disappears, but the notifications in the Notification Center remain. On the other hand, when I call application.applicationIconBadgeNumber = 0, the badge disappears and all notifications in the Notification Center are cleared. Additionally, if no badge is displayed, calling application.applicationIconBadgeNumber = 0 does not clear the notifications in the Notification Center. Is this behavior expected? If it is expected, is there a way to call setBadgeCount(0) and clear all notifications in the Notification Center? Also, is there a way to call application.applicationIconBadgeNumber = 0 without clearing the notifications in the Notification Center?
2
0
511
Jun ’24