Notification Center

RSS for tag

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

Posts under Notification Center tag

51 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

[iOS 26 beta] Unexpected Behavior: didRegisterForRemoteNotificationsWithDeviceToken Invoked Before User Notification Authorization on iOS 26 Beta
I'm encountering an issue with our legacy Objective-C codebase that uses UIApplicationDelegate. Here are the steps to reproduce the issue: Uninstall the application from the device. Install and launch the application. As part of the launch event, the client requests notification permission. The permission prompt is still displayed, even though the client receives a remote notification token (which appears to be a cached one). I followed the same steps with a sample app built with Swift (SwiftUI), and this issue did not occur. In the Swift app, I consistently received a delegate<didRegisterForRemoteNotificationsWithDeviceToken> call after the user allowed the notification permission. Could you please provide some insights into why this might be happening with only our client?
3
0
98
3d
Is it possible to programmatically set macOS notification preferences for an app in Swift?
Hi, I’m working on a Safari extension for macOS, and I’d like the app to use specific system notification settings right after installation. I’m wondering if there’s a way in Swift to programmatically configure the default notification preferences (as seen in System Settings > Notifications > [my app]). Here are the desired settings: Only Desktop – without “Notification Center” or “Lock Screen” Alert Style: Temporary Badge App Icon: Enabled Play Sound for Notifications: Disabled Show Previews: When Unlocked Notification Grouping: Off (I don’t want them to accumulate in Notification Center) Here is the code I’m currently using to display a basic notification: private func handleNotificationRequest(_ message: [String: Any]) { guard let title = message["title"] as? String, let body = message["body"] as? String else { return } UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .badge, .sound]) { granted, error in if granted { self.showNotification(title: title, body: body) } } } private func showNotification(title: String, body: String) { let content = UNMutableNotificationContent() content.title = title content.body = body content.sound = nil // No sound for subtle notification // Create notification that doesn't persist in notification center let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 0.1, repeats: false) let request = UNNotificationRequest(identifier: "fast-url-copy-notification", content: content, trigger: trigger) UNUserNotificationCenter.current().add(request) { error in if let error = error { os_log(.error, "Failed to show notification: %@", error.localizedDescription) } } } OS: macOS 26.0 Thanks in advance, Mateusz
1
0
377
6d
didReceive isn't called in CarPlay scene
I have set up an iOS application with CarPlay scene using carplay-driving-tasks entitlement. And as per latest policy changes I'm able to get push notifications in the CarPlay screen. But unlike from phone scene, when I tap on a notification from CarPlay I don't get a trigger on didReceive method to intercept the payload of the notification that user tapped on. Is there any other ways or configuration needed to get this working? I just need to get the payload and present an Alert template within the CarPlay when user taps on a CarPlay notification and the app opens.
0
0
22
2w
Notification Service Extension and the main thread
Question, if I am writing async code in the notification service extension, I understand it terminates after 30 seconds. If I want to wait until these async methods finish before calling the content handler, I believe an option I have is to use dispatch groups. However I am open to other solutions if there are better options. My question is, if I use dispatch groups, is there any issue in using the main queue here? Or does the main thread not make sense to use in the context of the NSE? dispatch_group_notify(group, dispatch_get_main_queue(), ^{ if (self.contentHandler) { self.contentHandler(self.bestAttemptContent); } }); Or is it recommended to instead use a different queue in the NSE? dispatch_queue_t nseQueue = dispatch_queue_create("com.blah.blah.nse.queue", DISPATCH_QUEUE_SERIAL); dispatch_group_notify(group, dispatch_get_global_queue(QOS_CLASS_(SOMETHING), 0), ^{ ... }); OR am I over thinking this? :) Thanks ahead of time, relatively new to iOS so just looking to learn/understand better.
3
1
206
2w
App Notifications - Audible Alert Schedule
Hi all, First time poster :) I am interested to understand if it is possible to set a notification alert within an application. I am building an application on internet connectivity health but want users to be able to choose a time when the notification is audible or silent. (appreciate you can set the device to a status where notifications are silenced) Within the application if they choose to be alerted to critical alerts, I would like them to be able to choose a time period when the alerts should be silent or when they should be audible. Who wants alert on your internet at 2am when Maintenace windows open up? Cheers Dan
1
0
120
3w
System clock ancs notification is not sent on iPhone >= 14
I'm working on a ble connected device that use ancs and system clock to receive alarm notification events for earing impaired people. It used to work until iPhone 13 with latest iOS 18.x. Starting with iPhone 14 onward (iOS 18.x), system clock alarm notification is not sent anymore. Is There any reason for this to happening?. Is anyone aware of this behaviour? Any suggestion would be really appreciated. Cheers
2
0
115
Jun ’25
Regarding the change of device tokens after an iOS update
In the app we are developing, we update the device token upon app launch using didRegisterForRemoteNotificationsWithDeviceToken. Previously, after an iOS major update, if the app was left without being launched, users experienced an issue where notifications would not be received. Later, we confirmed that running didRegisterForRemoteNotificationsWithDeviceToken during app launch updates the device token and restores the ability to receive notifications. Therefore, we believe that the device token may change due to an iOS major update. We want to understand the detailed conditions under which the device token is updated due to an iOS update: Does the same issue occur after iOS minor updates as well? Does it always happen during iOS major updates? We reviewed the official documentation, but there was no detailed description of the device token update conditions. Additionally, we contacted Apple, but received no clear answers. If anyone has experienced the same situation, we would appreciate any information you can share.
2
0
85
Jun ’25
The NSTextViewDelegate method textViewDidChangeSelection(:) will not fire, while all other text view delegate methods do.
I am trying to implement the NSTextViewDelegate function textViewDidChangeSelection(_ notification: Notification). My text view's delegate is the Coordinator of my NSViewRepresentable. I've found that this delegate function never fires, but any other delegate function that I implement, as long as it doesn't take a Notification as an argument, does fire (e.g., textView(:willChangeSelectionFromCharacterRange:toCharacterRange:), fires and is called on the delegate exactly when it should be). For context, I've verified all of the below: textView.isSelectable = true textView.isEditable = true textView.delegate === my coordinator I can call textViewDidChangeSelection(:) directly on the delegate without issue. I can select and edit text without issues. I.e., the selections are being set correctly. But the delegate method is never called when they are. I am able to add the intended delegate as an observer for the selector textViewDidChangeSelection via NotificationCenter. If I do this, the function executes when it should, but fires for every text view in my view hierarchy, which can number in the hundreds. I'm using an NSLayoutManager, so I figure this should only fire once. I've added a check within my code: func textViewDidChangeSelection(_ notification: Notification) { guard let textView = notification.object as? NSTextView, textView === layoutManager.firstTextView else { return } // Any code I want to execute... } But the above guard check lets through every notification, so, no matter what, my closure executes hundreds of times if I have hundreds of text views, all of them being sent by textView === layoutManager.firstTextView, but once for each and every text view managed by that layoutManager. Does anyone know why this method isn't ever called on the delegate, while seemingly all other delegate methods are? I could go the NotificationCenter route, but I'd love to know why this won't execute as a delegate method when documentation says that it should, and I don't want to have to implement a counter to make sure my code only executes once per selection update. And for more reasons than that, implementing via delegate method is preferable to using notifications for my use case. Thanks for any help!
3
0
104
May ’25
Detecting Notification Banners, DND, and other screen anomalies
Is there a public method to know when an APNS has appeared on the screen? wrapping up a very high end photogrammetry app, using the front facing camera and screen illumination- incoming notifications completely throw off the math. Ideally, it would be great to turn on Do Not Disturb for the short process, but we’d settle for just the detection of the notification banner. also: extra credit - programattically adjusting Auto Dimming, and True Tone would be lovely too.
0
0
26
May ’25
Clarification about ANCS being unavailable
Hello, I am working on a project that involves using external device to connect over BLE with users iPhone. I would like to be able to notify users on our device about eg. incoming calls, messages etc. I have been succesfull in using ANCS to achieve that but I am a little worried around consistency of this solution, especially taking into account following line from documentation: Due to the nature of iOS, the ANCS is not guaranteed to always be present. As a result, the NC should look for and subscribe to the Service Changed characteristic of the GATT service in order to monitor for the potential publishing and unpublishing of the ANCS at any time. I have not been able (yet?) to find or identify circumstances when ANCS would not be avilable or would be "removed in runtime", hence would it be possible to request some guidance and clarification on the conditions when ANCS can be unavailable or removed? Thank you!
2
0
73
Apr ’25
Alternate App Icon Change Does Not Reflect in Notification Center on iOS 18.1+
When changing the app's alternate icon using UIApplication.setAlternateIconName(_:completionHandler:), the icon is updated correctly on the Home Screen and App Switcher. However, in Notification Center, the old app icon is still shown for notifications, even after the change has completed. Rebooting or change the device's language causes the correct icon to appear. This issue only occurs on iOS 18.1 and later. In iOS 18.0 and earlier, Notification Center correctly reflects the updated icon. Could you provide insights into how iOS caches notification icons and how we can force a refresh for all users?
1
0
63
Apr ’25
Alternate App Icon Change Does Not Reflect in Notification Center on iOS 18.1+
Version: iOS 18.1 and later (works as expected on iOS 18.0 and earlier) Area: SpringBoard / Notification Center / App Icon Rendering Description: When changing the app's alternate icon using UIApplication.setAlternateIconName(_:completionHandler:), the icon is updated correctly on the Home Screen and App Switcher. However, in Notification Center, the old app icon is still shown for notifications, even after the change has completed. This issue only occurs on iOS 18.1 and later. In iOS 18.0 and earlier, Notification Center correctly reflects the updated icon. - Steps to reproduce: Create an iOS app with alternate app icons configured in the Info.plist. Use UIApplication.shared.setAlternateIconName("IconName") to change the icon at runtime. Send a notification. Pull down Notification Center and observe the icon shown beside the notification. - Expected Behavior: Notification Center should reflect the updated (alternate) app icon immediately after the change. - Actual Behavior: Notification Center continues to display the old (primary) app icon. The new icon appears correctly on the Home Screen and App Switcher. Restarting the device does cause Notification Center to update and reflect the correct icon, which suggests a cache or refresh issue in SpringBoard or Notification Center. - Notes: Issue introduced in iOS 18.1; not present in 18.0. Reproduces on both physical devices and simulators. Occurs with both scheduled local notifications and remote notifications. Restarting the device updates the Notification Center icon, but this is not a viable user-facing workaround.
1
0
88
Apr ’25
Download and Store Custom Notification Sound for Playback in All App States (Foreground, Background, and Terminated)
I want to implement a feature where a custom notification sound file is downloaded from the server when the app is first launched and stored locally on the device. When a push notification arrives, the stored sound should be played in all app states, including foreground, background, and terminated (killed) state. Does anyone have an idea on how to implement this in iOS? Specifically, I am looking for guidance on: 1)Downloading and storing the sound file securely on the device. 2)Using the locally stored file for push notification sounds. 3)Ensuring the sound plays correctly in all states, including when the app is not running.
0
0
49
Apr ’25
Inconsistent grouping of notifications
I'm sending push notifications to a notification extension, and within the extension setting the threadIdentifier to be the same. But I'm observing inconsistent grouping behaviour, and behaviour that changes over time. The general iPhone settings are to display notifications as a Stack, and the app settings are to show on lock screen, notification center and banners and the notification grouping is set to by app (changing it to automatic doesn't affect the behaviour below). Pushes are displayed on the lock screen grouped together, then if the device is roused and the screen swiped down to reveal the notification center then they are still grouped. So far so good. If the iphone is active then the notifications appear at the top of the screen, one by one, but in this case if there is a swipe down to reveal the notification center then the notifications are not grouped when displayed, but shown individually. But then if one waits a few minutes and then displays the notification center for a 2nd time, sometimes now they will be grouped, but sometimes not. Why are they not (always) being displayed as grouped in the notification center?
1
0
48
Mar ’25
Weather Notifications
I'm strugling about the way how to code notifications for my weather aplication. I use data from my server that receives weather changing values from my own weather station and want to notify user of my app when eg strong wind will blow or temperature go under eg 3℃ etc. The weather station has 8 sensors so there is sometimes a lot of data changing in particular minute that i set to parse data from server and notify user about it. But the notifications only works only when app is on and couple minutes after locking display. So please what could i use strategy for the app to works even when the app sleeps ?
1
0
48
Mar ’25
What is the point of thread-id/grouping in push notifications if grouping depends upon user preferences?
There's plenty of articles out there about programatically grouping push notifications. However I have tried setting the thread-id in the push payload when sending a push, or setting the threadIdentifier for a received push in a notification service extension to be the same for several pushes. But if within the iPhone Settings / Notifications the user selects to display pushes as List and turns off Notification Grouping, then each notification resulting from the push appears on its own separately. Is there something other than thread-id/threadidentifier that is used to programmatically group them? If not then whats the point of these as grouping and display is actually under the control of user.
1
0
51
Mar ’25
WidgetKit: add new widget to bundle
Hi, I have an existing Mac app on the App Store with a couple of widgets as part of the app. I want to now add a new widget to the WidgetBundle. When I build the updated app with Xcode, and then run the updated app, the widgets list doesn't seem to get updated in Notification Center or in the WidgetKit Simulator. I do have the App Store version installed in the /Applications folder as well, so there might be some conflict. What's the trick to getting the widgets list to run the debug version?
0
0
46
Mar ’25