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

Invalid iss (issuer) from APNS p8 device
I have generated a key for APNS push notification in a newly created Apple account. However if I check the certificate with the Apple tool https://icloud.developer.apple.com/dashboard/notifications/ it displays "invalid iss (issuer)" (If I want to use it, I get a 403 error ("InvalidProviderToken"), that is logical) (it works fine on other account with the working generated key) Any idea to understand the issue ?
3
0
237
Aug ’24
Is the Communication Notifications capability required for a Notification Service Extension and a Notification Content Extension?
I would like to add both a Notification Service Extension and a Notification Content Extension to my application. After reading some documentation and tutorials etc. I'm not clear if the Communication Notifications capability is needed or not. If it is, should it get added to the App ID or the notification IDs, or both?
1
0
343
Aug ’24
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
330
Aug ’24
There are some difference between Push Notifications Platform 's statue result and doc
in Push Notifications Platform : when i test the device remove our app , the status result is “- discarded as device was offline” when i test close the notification auth in our app, the status result is “- stored for device power considerations" but i saw the flow in doc , I didn't directly saw that these two states are like this https://developer.apple.com/documentation/usernotifications/viewing-the-status-of-push-notifications-using-metrics-and-apns how can i know the directly status in this two cases ?
0
0
306
Aug ’24
APNS traffic not honoring the routing table?
I was seeing APNS traffic not honor the networking routing table and instead forced onto a specific interface starting in the beta releases of macOS Sequoia. I wanted to ask here to see if it was by design. Were there any release notes or communication in regards to this change? I can imagine it being an intentional fix for some issue that Apple customers ran into, but I can also imagine this could be unintentional or a bug, so I wanted to double check. Thank you
1
1
348
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
371
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
347
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
197
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
249
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]?) -> 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) -> 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) -> 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?) -> 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<string>} 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) => console.log("Message sent successfully:", response)) // .catch((error) => console.error("Failed to send message:", error)); We would really appreciate any insights or guidance on these issues. Thank you!
5
0
652
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
486
Aug ’24