Notifications

RSS for tag

Learn about the technical aspects of notification delivery on device, including notification types, priorities, and notification center management.

Notifications Documentation

Post

Replies

Boosts

Views

Activity

Apple Push Notification service server certificate update
The Certification Authority (CA) for Apple Push Notification service (APNs) is changing. APNs will update the server certificates in sandbox on January 20, 2025, and in production on February 24, 2025. All developers using APNs will need to update their application’s Trust Store to include the new server certificate: SHA-2 Root : USERTrust RSA Certification Authority certificate. To ensure a smooth transition and avoid push notification delivery failures, please make sure that both old and new server certificates are included in the Trust Store before the cut-off date for each of your application servers that connect to sandbox and production. At this time, you don’t need to update the APNs SSL provider certificates issued to you by Apple.
0
0
283
Oct ’24
Notification Received in Kill Mode but No Method Invoked in iOS
Hello Apple Developer Team, I am facing an issue with remote notifications in my iOS app. When the app is in a terminated (kill) state, notifications are successfully received by the device, but none of the app's handlers (like _firebaseMessagingBackgroundHandler in Flutter) are invoked. This is impacting our ability to process silent notifications or perform background tasks reliably when the app is not running. Steps to reproduce: Send a remote notification with content-available: 1 in the payload. Confirm the notification is received by the device while the app is in kill mode. Observe that no background or foreground notification methods are triggered in the app. Expected Behavior: The app should invoke the background handler to process the notification payload, even in a terminated state. Observed Behavior: The notification is delivered to the device, but no app-level processing occurs because none of the methods are triggered. Can you please confirm if this is the intended behavior due to iOS limitations, or if there is a configuration or alternative solution to allow background handlers to execute in such scenarios? Any guidance or clarification would be highly appreciated. Thank you!
1
0
61
17h
Why is willPresentNotification called twice here?
Please find below a complete app example. It has a button, when you press it, a local notification is created. However, the UnNotificationCenter.delegate is called twice, and I can't understand why. I am trying to move my project from Objective-C to Swift, and my similar code there doesn't get called twice, so I'm confused. Can anybody shine a light on this? Pointers appreciated. App: @main struct NotifTestApp: App { init() { UNUserNotificationCenter.current().delegate = NotificationReceiveHandler.shared configureUserNotifications() } var body: some Scene { WindowGroup { ContentView() } } private func configureUserNotifications() { UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .badge, .sound]) { granted, error in if granted { print("Notification permission granted.") } else if let error = error { print("Error requesting notification permissions: \(error)") } } } } class NotificationReceiveHandler: NSObject, UNUserNotificationCenterDelegate { static let shared = NotificationReceiveHandler() //>> THIS IS CALLED TWICE WHEN I PRESS THE BUTTON func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) { NSLog(">>> Will present notification!") completionHandler([.sound]) } } ///THE UI struct ContentView: View { var body: some View { VStack { Text("👾") .imageScale(.large) .foregroundStyle(.tint) Text("Notification test!") Text("When i press the button, will present is called twice!!").font(.footnote) .padding(10) Button("Create Notification") { createNotification( message: "This is a test notification", header: "Test Notification", category: "TEST_CATEGORY", playSound: true, dictionary: nil, imageName: nil) } .padding() .background(Color.blue) .foregroundColor(.white) .cornerRadius(8) } .padding() } } #Preview { ContentView() } private func createNotification(message: String, header: String, category: String, playSound: Bool = true, dictionary: NSDictionary? = nil, imageName: String? = nil) { let content = UNMutableNotificationContent() content.title = header content.body = message content.categoryIdentifier = category content.badge = NSNumber(value: 0) if let imageName = imageName, let imageURL = Bundle.main.url(forResource: imageName, withExtension: "png") { do { let attachment = try UNNotificationAttachment(identifier: "image", url: imageURL, options: nil) content.attachments = [attachment] } catch { print("Error creating notification attachment: \(error)") } } content.sound = playSound ? UNNotificationSound(named: UNNotificationSoundName("event.aiff")) : nil if let infoDict = dictionary { content.userInfo = infoDict as! [AnyHashable: Any] } let request = UNNotificationRequest(identifier: UUID().uuidString, content: content, trigger: nil) UNUserNotificationCenter.current().add(request, withCompletionHandler: nil) }
9
3
1.4k
Aug ’24
Silent push notifications not working on some iOS devices
I send APNs notifications to my devices with the CloudKit dashboard. I test with two devices; Device with Silent Push Working Successfully: iOS version 16.5.1 (c), Model iPhone Xs Silent Push Failed Device: iOS version 15.3.1, Model iPhone Xr Normal alert notifications work successfully on both devices. But I can't see any log in my project even though silent push is sent successfully on one device. What I've Checked: content-available is set to 1. My app is not in kill state, it is in foreground or pending in the background. When I send simple notifications, I can see logs in my swift project and notifications on physical devices without any problem. No, my certificate has not expired and if there was a problem with it, I would not be able to see the normal notifications. My phone is not in power saving mode and the “Background App Refresh” option is turned on in the app's settings. Both devices in charging state. App capabilities: Background Modes is enabled with Remote Notifications, Background Fetch, Background Processing. CloudKit Dashboard After Sending Silent Push: My AppDelegate Class In Swift Project: import SwiftUI import UIKit import UserNotifications class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .sound, .badge]) { granted, error in if granted { DispatchQueue.main.async { UIApplication.shared.registerForRemoteNotifications() } } } return true } func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) { let tokenParts = deviceToken.map { data in String(format: "%02.2hhx", data) } let token = tokenParts.joined() print("Device Token: \(token)") } func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) { print("Failed to register: \(error)") } func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) { logInfo("Received Push Notification: \(userInfo)") if let aps = userInfo["aps"] as? [String: AnyObject], aps["content-available"] as? Int == 1 { logInfo("This is a silent push notification") //DO SOME WORK completionHandler(.newData) } completionHandler(.newData) } }
2
0
57
16h
userNotificationCenter(_:willPresent:withCompletionHandler:) Triggered Twice in iOS 18
I'm encountering an unexpected issue in my app since upgrading to iOS 18, and I’m wondering if anyone has found a solution or workaround. The Problem: The userNotificationCenter(:willPresent:withCompletionHandler:) method is being triggered twice whenever a push notification arrives while the app is in the foreground. Additionally, application(:didReceiveRemoteNotification:fetchCompletionHandler:) is also being triggered once during the same notification event. This redundant triggering is causing inconsistent behavior and double-processing of notifications, which is obviously problematic for my use case. The exact flow looks like this: userNotificationCenter(:willPresent:withCompletionHandler:) — called twice. application(:didReceiveRemoteNotification:fetchCompletionHandler:) — called once. Has anyone else experienced this behavior specifically in iOS 18? Is this a known issue with the new version? This issue is affecting how we handle notifications in a major way, and I’m hoping there's a more fundamental fix or explanation for this behavior in iOS 18.
1
0
30
14h
Is there a way for a device to detect when VoIP Push has been blocked?
Hello, I am developing an application using VoIP Push and CallKit. I have a question: Starting with iOS 13, I understand that under the VoIP Push policy, if reportNewIncomingCall is not called continuously, the VoIP Push may be blocked. Is there a way to determine if the device has been blocked? I am curious whether PKPushRegistry itself is unable to receive pushes or if reportNewIncomingCall returns an error when it is blocked. If push notifications are not being received, what should I do to resume receiving them? Thank you.
3
0
146
2w
push notifications lost
Hi) we have two ios apps in same Firebase project - with different apple bundle ids. One of them had connected APNS with Firebase and everything had worked perfectly - push notifications where delivered every time. But recently we occationaly put same APNS to other our Firebase's ios app and as result we lost all pushes - on both app. After deletion APNS from both of them and reconnecting APNS to app with proper apple bundle id push notifications didn't start to work. could you please suggest what we are suppose to do to resolve issue?
1
0
58
1d
Do I need to update the certificate of the APNs?
Currently, our provider server uses token-based authentication with APNs. In addition, to establish a connection with APNs, we have installed the "AAACertificateServices 5/12/2020" certificate from the "Sectigo KnowledgeBase website" on the provider server. Question 1 Do I need to update the server certificate of the Apple Push Notification Service at the following URL for the above provider server? URL https://developer.apple.com/jp/news/?id=09za8wzy Question 2 If registration is required, how long will it be valid for? Root certificate https://developer.apple.com/documentation/usernotifications/setting-up-a-remote-notification-server Token-based authentication https://developer.apple.com/documentation/usernotifications/establishing-a-token-based-connection-to-apns
0
0
63
1d
Should I prepare to Apple renewal of APNs USERTrust RSA Certification Authority certificate?
On apple dev site in the news section here you can find two announcements about their renewal of: USERTrust RSA Certification Authority certificate. Context: now, I have an app delivered via in-house distribution due to Apple developer Enterprise program. My app uses push notifications, but we are using auth tokens. Should I do something on the app? Should I advice backend colleague to check or do something server-side? below you can find the two announcements: sanbox link APNs Certificate Update Begins January 20, 2025 The Apple Push Notification service (APNs) will be updated with a new server certificate in sandbox on January 20, 2025. Update your application’s Trust Store to include the new server certificate: SHA-2 Root : USERTrust RSA Certification Authority certificate. and production link APNs Certificate Update Begins February 24, 2025 The Apple Push Notification service (APNs) will be updated with a new server certificate in production on February 24, 2025. Update your application’s Trust Store to include the new server certificate: SHA-2 Root : USERTrust RSA Certification Authority certificate.
0
0
63
2d
APNS: Unexpired, priority=10, type=alert sometimes do not appear in Notification Center when coming back online
System Information: iPhone 13, iOS 17.6.1 Steps to reproduce: Open my app, causing it to register for an APNS token Kill my app to make sure it is not in the foreground Send a push notification with a payload similar to this: {"aps":{"alert":{"title":"My App Name","body":"10:24am 🚀🚀🚀"}},"price":19,"clock":175846989,"time":1731001868.379526} And the following attributes: Expiry: (Date that is 7 days from now) Type: Alert Priority: High (10) Payload Size: 141 bytes The notification appears in the Notification Center, as expected Turn on Airplane Mode (WiFi=off) Wait between 60 seconds - 8 hours (varies) Send the same notification payload/attributes again Wait between 60 seconds - 8 hours (varies) Turn on WiFi Wait 1-30 minutes (varies) Expected behavior: The notification appears in the Notification Center Actual behavior: Push notifications from other apps immediately appear in the Notification Center Roughly 30% of the time: The push notification(s) from my app never arrive, even after waiting 30 minutes Roughly 70% of the time: The notification appears in the notification center, and everything works fine Thoughts: Expiry must be set correctly because I've seen my notifications get queued and then delivered (correctly) in the CloudKit Push Notification tool. Identical notifications (payload, APNS headers, etc.) are also sent to other devices at the same time. They receive the notifications just fine. It must not be my iPhone's notification Settings, because notifications appear correctly when online I've tried restarting the iPhone, it did not fix this issue So it seems it must be an unexpected behavior in APNS or something broken with my specific phone? Not sure what else I could possibly do to make sure the notifications arrive. This breaks the entire experience of my app. I need to be able to notify users of incoming messages so they do not miss them.
6
0
159
1w
Critical alert delay
I am sending push notifications to the app with critical alerts, but there is a significant delay. If the number of target devices is 1000 or less, notifications will be received normally within a few seconds to a minute. Once the number of target devices exceeds 1000, some devices will arrive quickly (normally within a few seconds to 1 minute) and others will arrive late (3 minutes to 15 minutes, divided into hundreds of items). In severe cases, notifications to more than 80% of devices will be delayed. Example: If you send 3000 notifications at once,  1 minute: Notify 400 items  5 minutes: Notify 1000 items  10 minutes: Notify 1000 items  13 minutes: Notify 600 items *The timing of 5 minutes, 10 minutes, and 13 minutes changes every time and is not at regular intervals. We understand that according to the push notification specifications, sending several thousand messages at once is not a problem. Please let me know if there is a rule, such as sending 1000 items at a time, in order to deliver quickly and with minimal delay.
3
0
107
3d
Regression: Heavy Delay of Push Notifications on iOS 18.1 beta (10s and more)
My app one sec uses push notifications to guide the user back to the app from a Screen Time Shield (screenshot attached). On iOS 18.1, notifications are delivered with a delay of 10+ seconds, even though they are classified as time sensitive: notificationContent.interruptionLevel = .timeSensitive notificationContent.relevanceScore = 1.0 The notification trigger is nil, which according to the documentation should show the notification banner immediately: var notificationTrigger: UNTimeIntervalNotificationTrigger? = nil "The condition that causes the system to deliver the notification. Specify nil to deliver the notification right away." In the sysdiagnose I have noticed that activity related to Apple Intelligence Priority classification delays the notification by 10 seconds ("UserNotificationsCore.IntelligenceActor"): [create, [id=43C0-B333, time=2024-09-27 06:03:26, bundle=***.riedel.one-sec], Time elapsed=10.373 sec]: Timeout of 10.0 reached. Cancelling work. [create, [id=43C0-B333, time=2024-09-27 06:03:26, bundle=***.riedel.one-sec], Time elapsed=10.377 sec]: Calling out to completion with failure(UserNotificationsCore.StepFailure.timedOut(exceeded: 10.0 seconds, summaryStatus: Optional(UserNotificationsServices.NotificationSummaryStatus.inferenceTimedOut), priorityStatus: Optional(UserNotificationsServices.NotificationPriorityStatus.inferenceTimedOut))) from 'scheduleTimeoutToPerform(after:for:)' [create, [id=43C0-B333, time=2024-09-27 06:03:26, bundle=***.riedel.one-sec], Time elapsed=10.378 sec]: Step: UserNotificationsCore.IntelligenceActor, index: 0 exceeded 10.0 seconds This seems like a bug to me, time sensitive notifications should be exempted from being analyzed for priority, especially if that comes at the cost of delaying notifications by 10 seconds. Tracked in Radar: FB15255061
13
5
1.9k
Sep ’24
Disable optimised battery charging notifiction
I am on the developer beta ios 18.2 beta 3 on Iphone 16 Pro Max and, if I enable battery optimization charging I am woken up during the night when it is charged to 100% (which by the way isn't a couple of hours before my scheduled alarm goes off at 05:30 every day it reaches 100 about 3-4 hours earlier). There are no other notifications firing and if I turn this off and set the charge limit to 80% it successfully charges to this overnight without any notifications. If there isn't an option please can one be added as currently, I am unable to use this feature without being woken up during the night? The charger is new and connection is fine as there are no other sounds until the optimized charging reaches 100%.
1
0
64
1w
Short spikes in timeout calling APNS
Hello, I would like to check with you on a possible APNS issue. We saw a huge spike in the number of failed requests towards APNS (both api.push.apple.com and api.development.push.apple.com). On October 31st, at 13:39 (during 1 or 2 minutes), more than 700k requests failed. Which means more than 10% of all requests made by our service to api.push.apple.com. Our service is sending notification requests for more applications, different AppIds, in high amounts. Even more concerning is the fact that it happens more or less regularly now. 2-3 times a week. Still, just for short time, but I would like to check with APNS, whether it is something you know about. Checking graphs in CloudKit did not help me much. They don't allow good enough granularity. Not more precise than 1 day. Please, let me know if you are aware of some very short transient issues in APNS. Happening more or less regularly, with noticeable impact.
3
0
193
1w
Email notification on Lock Screen not appearing
Using the native email ios mail app iPhone 16 pro. When an email arrives the phone will ding or vibrate, but the message notification doesn't appear on lock screen. If you touch the screen from dim to wake then scroll up, the email notification does appear. If the phone is open the notification also appears at the top of screen as it's meant to do. This started yesterday with iOS 18.2 beta 1. It was not resolved with the new update.
2
0
126
1w
Difference between Push delivery metrics in APNs console vs. 410 code for unregistered tokens
Hi there, We’re using APNs Push delivery metrics, which provide a breakdown including metrics like Received by APNs, Delivered to Device, and Discarded - Token Unregistered. To track unregistered tokens on our end, we also monitor the 410 error responses from APNs, which typically indicate that a token is no longer valid. However, we’ve noticed a discrepancy: the number of 410 errors we receive is much lower than the Discarded - Token Unregistered count shown in the APNs console. Is this difference expected? Specifically, does APNs sometimes know that a token is unregistered but still return a success status to us when we attempt to send a push to that token? Thank you for any insights you can provide!
1
0
147
1w