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

Delay in APNS notification delivery
One of our customer has reported that pushes are delivered with big delay. Pushes are send to APNS in less than 5 seconds as per our statistics but it takes sometimes up to 5 minutes for notifications to arrive on devices. The authentication used is certificate based even though token based authentications is also tried out before. They have around 346252 subscribed device tokens (users) to which important pushes are send out. We use HTTP/2 based connections and reuses the connections. To avoid push bursts over selective connection, we distribute push traffic across different APNs servers. Sample headers: [:method: POST, :authority: api.push.apple.com, :path: /3/device/, :scheme: https, apns-expiration: 1723721057, apns-priority: 10, apns-topic: , authorization: bearer ] Sample payload: {"reference":"{"id":"lux.DvKH5JCtCcus5EaW5Houcn","type":"articleReference"}","aps":{"badge":0,"alert":{"body":"„Warum werden nicht ein paar gesetzliche Feiertage gestrichen?“ Munich-Re-Chef Joachim Wenning fordert, dass die Deutschen mehr arbeiten sollten"},"sound":"default","mutable-content":1},"tracking":"{"piano":{"ivw_category":"thema_wirtschaft","pcat":"paid","date_sent":1723629099370,"main_topic":"unternehmen","push_channel":"11124","section":"wirtschaft","object_id":"lux.DvKH5JCtCcus5EaW5Houcn","push_text":"warum_werden_nicht_ein_paar_gesetzliche_feiertage_gestrichen_munich_re_chef_joachim_wenning_fordert_dass_die_deutschen_mehr_arbeiten_sollten_plus"},"ivw":{"ivw_category":"thema_wirtschaft","ivw_code":"spracheDE/formatTXT/erzeugerRED/homepageNO/auslieferungMOB/appYES/paidNO/inhaltTHEMA/merkmalWIRTSCHAFT/ressortWIRTSCHAFT/portalAPP"},"firebase":{"ivw_category":"thema_wirtschaft","pcat":"paid","date_sent":1723629099370,"main_topic":"unternehmen","push_channel":"11124","section":"wirtschaft","object_id":"lux.DvKH5JCtCcus5EaW5Houcn","push_text":"warum_werden_nicht_ein_paar_gesetzliche_feiertage_gestrichen_munich_re_chef_joachim_wenning_fordert_dass_die_deutschen_mehr_arbeiten_sollten"}}"} Please let us know what could be the reason and steps we could take to avoid such delivery delays.
3
0
373
Aug ’24
Silent Push Notification in background also triggered didFinishLaunchingWithOptions
About 2 or 3 months ago, when my app receive a Silent Push notification([aps][content-available] = 1), only func "application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler" had triggered. But now, when my app receive Silent push, my app triggered 3 func :"didFinishLaunchingWithOptions"; "application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo" and "application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler". Does Apple update this logic? Are there any solution to push silent that just triggered only one func like before?
1
0
391
Aug ’24
subscriptions[UPGRADE]
Hello, I am a backend developer currently handling Apple's auto-renewable subscriptions. I have two different products in the same subscription group, one is a monthly subscription, and the other is a quarterly subscription, with the quarterly subscription having a higher priority than the monthly one. Currently, I subscribed to the monthly plan in the sandbox environment and then upgraded to the quarterly plan. I only received an UPGRADE notification. I would like to confirm whether this is the only notification I should expect, or should I receive an upgrade notification, a subscription notification for the quarterly plan, and a refund notification for the monthly plan?
0
0
207
Aug ’24
Auto reply" Does not work while Focus Mode "Driving" Mode is ON
Dear Apple Support Team and Community Members, Despite the recent updates on the iOS 18.5 Beta version, several users, including myself, are experiencing issues with the Driving Focus mode. Specifically, when this mode is enabled with all the recommended settings, the iPhone fails to send auto-reply text messages to incoming callers, a critical feature meant to minimize distractions while driving. Key Issues Reported: Driving Focus Not Sending Auto-Reply Messages: Many users have meticulously configured the Driving Focus settings, ensuring that auto-reply is enabled and contacts are correctly set, but the feature still does not function as expected. Beta Updates Not Resolving the Issue: Even after installing the latest iOS 18.5 Beta updates, this problem persists, indicating that the bug has not been addressed in the current beta release. Request for Escalation and Resolution: We kindly request that this issue be escalated to the Apple development team for further investigation. Driving Focus is a crucial safety feature, and its malfunctioning could have serious implications. We hope for a prompt and concrete solution in the upcoming updates to ensure that this feature works reliably for all users. Thank you for your attention to this matter. Best regards, Tejas Desai A Concerned iOS User
0
0
270
Aug ’24
Push To Talk
I am using PushToTalk in my project for using only listing audio. steps :- App Launch :- Create PTT Channel PTT Token :- Send Token in Server App Kill :- It's Automatically restored channel using :- channelDescriptor(restoredChannelUUID channelUUID: UUID) -> PTChannelDescriptor Play audio given by incomingPushResult method issue :- I am receiving an audio link through incomingPushResult. When incomingPushResult is called, it automatically restores the channel. However, the channel has already been created, resulting in two channels being created. When I send the link from the server, the audio plays properly. However, if I resend the same link after 5-6 seconds, the audio does not play. After I leave the first channel, the same audio starts playing in the second channel. When I send the link again, the audio does not play because I left the first (main) channel. func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { UNUserNotificationCenter.current().delegate = self UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .sound, .badge]) { granted, error in if granted { DispatchQueue.main.async { application.registerForRemoteNotifications() } } } Task { await self.createChannel() } return true } func createChannel() async { do { channelManager = try await PTChannelManager.channelManager(delegate: self, restorationDelegate: self) let channelImage = UIImage(named: "ic_p") channelDescriptor = PTChannelDescriptor(name: "Pikachu", image: channelImage) let channelUUID = UUID() self.currentChannelUUID = channelUUID channelManager?.requestJoinChannel(channelUUID: channelUUID, descriptor: channelDescriptor!) print("PTT creating channel") } catch { print("Error creating channel: \(error)") } } func incomingPushResult(channelManager: PTChannelManager, channelUUID: UUID, pushPayload: [String : Any]) -> PTPushResult { guard let data = pushPayload["data"] as? [String: Any], let mediaLink = data["media_link"] as? String else { return .leaveChannel } print("incomingPTT") // URL to fetch the audio data from self.audioURL = mediaLink // Play the audio from the URL DispatchQueue.main.async { self.playSound(url: self.audioURL) } let participant = PTParticipant(name: mediaLink, image: .checkmark) return .activeRemoteParticipant(participant) } func channelDescriptor(restoredChannelUUID channelUUID: UUID) -> PTChannelDescriptor { let channelImage = UIImage(named: "ic_r") return PTChannelDescriptor(name: "Restored Channel", image: channelImage) } func channelManager(_ channelManager: PTChannelManager, didActivate audioSession: AVAudioSession) { print("Activated audio session") self.playSound(url: self.audioURL) } Output: - App Launch After App Kill Play audio :- Audio Play Success and leave the channel (Before Leave Channel View) After Leave Channel View
4
0
369
Aug ’24
Live Activity not showing when started via push notification, but alert is received and app dismisses to dynamic island
I am trying to start a live activity via push token with the below headers and payload. I am using the 'fetch-http2' npm module to execute the APNS request in a deno/typescript environment, and am authenticating via token/p8. The device receives the alert portion of the payload, but the live activity does not appear on the device. I get a 200 OK response from APNS with the unique ID, and dashboard shows notification was successfully sent to the device. The odd thing, when backgrounding the app dismisses to the Dynamic Island with the animation as if there were a live activity happening, but there is not. When I check Activity<MyAttributes>.activities on app launch, it's empty. I don't see any errors in Xcode when I have the app running/foregrounded when sending the request. Quitting the app restores normal behavior. TL;DR: I have regular APNS alert push notification requests working without issue from the same environment. However when attempting to start a live activity via APNS, the alert is received but the live activity does not appear, despite the app/system seemingly thinking there is one. What could I be missing, or what else could I try? I have checked that: My generated JWT and device token are valid according to CloudKit dashboard (again, standard push alerts are working as expected) I can successfully start a live activity locally/from foreground via Activity.request I have added Supports Live Activities and Supports Live Activities Frequent Updates to my app's info.plist, and also have the required capabilities enabled (remote push, background processing, background fetch) I am using the current device push-to-start token (obtained from device via Activity.pushToStartTokenUpdates) for the device token in the APNS request (NOT the update token) My ActivityAttributes and ActivityAttributes.ContentState values and types are correct "headers": { "authorization": "bearer {jwt}", "apns-push-type": "liveactivity", "apns-topic": "{bundleId}.push-type.liveactivity" } "aps": { "attributes-type": "LiveActivityAttributes", "attributes": { "title": "Test Event" }, "content-state": { "status": 1 }, "event": "start", "alert": { "title": "Alert Title", "body": "Live Activity has started." }, "sound": "default", "timestamp": Math.round(Date.now() / 1000) }
1
0
529
Aug ’24
iOS device doesn't connect MDM server
I have a few devices that don‘t connect MDM server. It work well after enroll the MDM server, but it won't work anymore after a few days. MDM server send apns request, apns server always return success, and i try power off / on, restore network, restore all settings, but still don't work. What could cause this situation,and is there a solution?
0
0
246
Aug ’24
Issues with Silent Notifications in Parental Control App Using FCM and Background Tasks
Hello, We are developing a parental control app consisting of two parts: a parent app to manage settings and a child app to enforce these settings using iOS's Screen Time API, CoreData, and other components. We've attempted to use silent notifications with Firebase Cloud Messaging (FCM) to communicate updates from the parent app to the child app. Our current implementation involves background modes for remote messages and background tasks. However, we're facing a challenge: while normal FCM push notifications with a 'message' key work as expected, silent notifications (with only a 'data' key) do not trigger the desired behavior in the child app, even though FCM returns a success response. We're looking for assistance with two main issues: Alternative Approaches: Is there a better way to notify the child app of changes? We're considering a system where the child app periodically checks for updates via API and then updates CoreData and managed settings. Any recommendations for this architecture or a more reliable notification system would be greatly appreciated. Debugging Silent Notifications: If our current approach using silent notifications is feasible, could someone help us debug why these notifications are not working as expected? We've been stuck on this for a week, and any help would be a lifesaver. Here's the relevant part of our AppDelegate code: import UIKit import FirebaseCore import FirebaseMessaging import BackgroundTasks @objc class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterDelegate { let gcmMessageIDKey = "gcm.message_id" let backgroundTaskIdentifier = "com.your-company.your-app.silentnotification" func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -&gt; Bool { FirebaseApp.configure() Messaging.messaging().delegate = self // Register for remote notifications UNUserNotificationCenter.current().delegate = self application.registerForRemoteNotifications() // Register background task BGTaskScheduler.shared.register(forTaskWithIdentifier: backgroundTaskIdentifier, using: nil) { task in self.handleBackgroundTask(task: task as! BGProcessingTask) } return true } // Handle incoming remote notifications func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -&gt; Void) { if let aps = userInfo["aps"] as? [String: Any], let contentAvailable = aps["content-available"] as? Int, contentAvailable == 1 { // This is a silent notification handleSilentNotification(userInfo: userInfo, completionHandler: completionHandler) } else { // This is a regular notification Messaging.messaging().appDidReceiveMessage(userInfo) completionHandler(.newData) } } // Handle silent notification func handleSilentNotification(userInfo: [AnyHashable: Any], completionHandler: @escaping (UIBackgroundFetchResult) -&gt; Void) { let request = BGProcessingTaskRequest(identifier: backgroundTaskIdentifier) request.requiresNetworkConnectivity = true do { try BGTaskScheduler.shared.submit(request) performAPICall { result in switch result { case .success(_): completionHandler(.newData) case .failure(_): completionHandler(.failed) } } } catch { completionHandler(.failed) } } // Handle background task func handleBackgroundTask(task: BGProcessingTask) { task.expirationHandler = { task.setTaskCompleted(success: false) } performAPICall { result in task.setTaskCompleted(success: result != nil) } } // Perform API call (placeholder implementation) func performAPICall(completion: @escaping (Data?) -&gt; Void) { // Your API call implementation here // For testing, you can use a simple delay: DispatchQueue.main.asyncAfter(deadline: .now() + 2) { completion(Data()) } } } extension AppDelegate: MessagingDelegate { func messaging(_ messaging: Messaging, didReceiveRegistrationToken fcmToken: String?) { print("FCM token: \(fcmToken ?? "nil")") // TODO: Send this token to your server } } Additionally, here is how we're sending notifications from the server side using Node.js: // Import the required Firebase Admin SDK (assumed to be initialized elsewhere) // const { getMessaging } = require('firebase-admin/messaging'); /** * Sends a background push notification to an iOS device * @returns {Promise&lt;string&gt;} The message ID if successful * @throws Will throw an error if the sending process fails */ async function sendBackgroundPushNotification() { // Construct the message object for a background push notification const message = { apns: { headers: { // Set the priority of the push notification "apns-priority": "5", priority: "5", // Indicate that this is a background refresh notification "content-available": "1", content_available: "1", // Specify the push type as background "apns-push-type": "background", // Set the topic to your app's bundle identifier "apns-topic": "com.your-company.your-app", // Replace with your actual bundle identifier }, payload: { aps: { // This tells iOS to wake up your app in the background "content-available": 1, }, }, }, // Custom data payload to be sent with the notification // Modify this object to include the data you want to send data: { // Add your custom key-value pairs here }, // Uncomment the following block if you want to include a visible notification // notification: { // title: "Notification Title", // body: "Notification Body", // }, token token: "DEVICE_FCM_TOKEN_PLACEHOLDER", }; try { // Attempt to send the message using Firebase Cloud Messaging const response = await getMessaging().send(message); console.log("Successfully sent background data to iOS:", response); return response; } catch (error) { console.error("Error sending background data to iOS:", error); throw error; } } // Example usage: // sendBackgroundPushNotification() // .then((response) =&gt; console.log("Message sent successfully:", response)) // .catch((error) =&gt; console.error("Failed to send message:", error)); We would really appreciate any insights or guidance on these issues. Thank you!
5
0
687
Aug ’24
Push Notification Error - 400 Invalid Push Token
We are using fcm to send push notifications. Recently we noticed some of our ios devices were not receiving push notifications, failing. By using the Push notification console we can see we are failing from APNS, with a 400 - Invalid Push Notification. Once this occurs we dont get push notifications on that device. We have tried re-logging in and re-installing the app. This does not work initially. However eventually they start working again after re-installing, usually after at least a day. { "code": 400, "message": "bad-request", "reason": "Invalid push token", "requestUuid": "ee04b0f1-c6aa-4b5e-87c0-7df754801d6f" } Any ideas why the token is deemed invalid? Is there any way to get more details?
3
0
804
Aug ’24
APNS push is not received by device when sent via backend despite 200 OK response received
I am attempting to send a push notification via APNS from a supabase edge function (deno/typescript). I receive a 200 OK response from APNS, and using the "apns-unique-id" I am able to look up the notification in the dashboard which shows the notification was successfully sent to the device. However the app/device does not receive the push. Using the dashboard, I can successfully send a test push to the device, and I also have FCM already implemented and working, so I assume the iOS/client-side setup is not the problem. I also verified that my generated JWT and device token are valid via the dashboard, plus I'm getting 200 back with the request, so I also assume that auth is not an issue either. Yet even with a simple alert payload such as below, nothing comes through. What else could be causing this issue? Perhaps I'm missing a step? The details of the request I'm making are below: url = "https://api.sandbox.push.apple.com:443/3/device/{deviceToken}" headers = { "authorization": "Bearer {jwt}", "apns-push-type": "alert", "apns-topic": bundleId, "apns-priority": 10 } body = { "aps": { "alert": { "title": "Test Notification", "body": "This is a test notification.", "sound": "default" } } }
1
0
505
Jul ’24
web app push notifications on native WKWebView
Hi, I'm required to create an app with a WkWebView, this web view should point to a webApp wich should send web notifications. this web app, downloaded on the "home" of my device, is working. But from what I can see on the web, it is not possible for me having a native swift app, with a WkWebView , receiving notifications from the web app. is it right? or there is a way to achieve this? I understand that WkWebView view are not working with Service Workers which it seems to me they are required. could someone help me? thanks in advance
3
0
373
Jul ’24
Refreshing Contact Provider Extension from NSE
Hi, While testing the new Contact Provider Extension in the iOS 18 betas I noticed that the Notification Service Extension is unable to connect to the CPE in order to trigger a refresh. The ContactProviderManager init throws an "Extension Not Found" error. The CPE documentation mentions a main use case of using notifications to trigger CPE updates: "An example of using this call is to handle a push notification to your app when the provided contacts from your server update." source Is the main app the only way to trigger a CPE update? The documentation does not specify this limitation. I have tested this on a physical iPhone 15 running iOS 18 beta 4. Thanks, Wes
4
1
504
Jul ’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
484
Jul ’24
The app must be updated to use the new Push to Talk framework pop up display even after adding PTT framework
Hello All, I am getting following popup for our application, I have implemented PTT Push To Talk framework by following https://developer.apple.com/documentation/pushtotalk/creating-a-push-to-talk-app We are using following VoIP entitlements, Our app support from iOS 12 i) com.apple.developer.pushkit.unrestricted-voip ii) com.apple.developer.pushkit.unrestricted-voip.ptt We have updated app with new Push To Talk framework and it's working fine. Our app's minimum deployment target is iOS-12.0 , So app will also work without using PTT framework for older iOS. Question, Why popup display even after new Push To Talk framework implementation? what should I do to remove this popup from showing? Should I do any other setting to complete this framework? Thanks.
5
0
674
Jul ’24
Notification Content Extension and Swift Complete Concurrency
According to the documentation (https://developer.apple.com/documentation/usernotificationsui/unnotificationcontentextension), a Notification Content Extension should consist of a UIViewController that adopts the UNNotificationContentExtension protocol. The only problem is that UNNotificationContentExtension's methods are not @MainActor isolated, but UIViewController is, which produces this error when you try to build your code with Complete concurrency checking turned on: Main actor-isolated instance method 'didReceive' cannot be used to satisfy nonisolated protocol requirement If you add nonisolated, you are then left with another problem in that UNNotification is not Sendable. What is the recommended solution to this problem?
2
1
423
Jul ’24
I have a few questions about Location Push Service and Screentime Family controls.
Hello. I have a few questions about Location Push Service and Screentime Family controls. Do Location Push Service and Screentime Family controls require permission to be tested with development builds? Will my application for permission to test be approved? How long does it take to receive results if I apply for permission? Is it possible to use the functionality of the Screentime api in LocationPushServiceExtention? Is it possible to control remotely even if I apply for Screen time API's Family Controls permission as an individual? (ex. Change Screen time settings by push from server) Information is needed to plan an app that includes both functions. Thank you
2
0
407
Jul ’24
Receiving 403 (InvalidProviderToken) from APNs Send Notification service
Experiencing 403s (InvalidProviderToken) [https://api.push.apple.com/3/device/] due to invalid or unverifiable provider tokens. We have noticed that after retrying the request inline, the notification is delivered successfully without any changes to the request even with same authorization token. Someone please guide or suggest why it is happening as the JWT token which is generated is correct because we are caching the jwt token and using the same token to send out the subsequent request which is kind of successfull. Sending the notification for multiple team Ids under the same application.
1
0
601
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
459
Jul ’24