Send push notifications to Mac, iOS, iPadOS, tvOS devices through your app using the Apple Push Notifications service (APNs).

APNS Documentation

Posts under APNS tag

228 Posts
Sort by:
Post not yet marked as solved
8 Replies
4.9k Views
Hi Team, I was trying to add NSE to my Project to show Rich messaging. Creation of the NSE target to the project - Successful. Creation of additional provisioning profile in developer portal for NSE and mapped it in XCode - Successful The APS payload contains the content-type: 1 and attachment url to download the media content - Successful. When notification arrive the will present method gets called first - Successful. The auto execution of Notification Service 'didReceive(_ request: UNNotificationRequest,          withContentHandler contentHandler: @escaping            (UNNotificationContent) - Void)' - failure. 6. Tried running the target instead of main app - failure 7. Tried attaching a debugger to get break point - failure 8. Debug and Console logs - failure 9. Additionally tried the below option from every developer suggestion but no luck. o  https://stackoverflow.com/questions/50853503/images-in-ios-push-notification o  https://stackoverflow.com/questions/51722109/unnotificationserviceextensions-didrecieve-not-called o  https://stackoverflow.com/questions/39663903/ios10-unnotificationserviceextension-not-called o  https://stackoverflow.com/questions/46463680/notificationserviceextension-not-called o  https://stackoverflow.com/questions/45483018/unnotificationserviceextension-not-working-on-iphone-5-ios-10 Could you please assist on the same to get it working as the notification service methods cannot be called explicitly and it needs to be triggered by OS. A quick, faster response and resolution is much appreciated.
Posted Last updated
.
Post not yet marked as solved
0 Replies
80 Views
In the apple APNS docs, it says: ‘When you have a notification to send to the user’ how do I determine the device has reach a state where the user needs a notification from normal websocket reception? for instance, let’s say Johnny and Amber are arguing over chat. They each send each other 50 texts, which are received over websocket. Johnny then leaves his phone chat, how does the push provider server know that Johnny needs APNS notifications to be sent? note that I am not having issue with sending notifications, nor do I want to send notifications for every chat message. if the switch from websocket -> APNS isn’t consistent, I’ll have to request data from the server, which includes data prior to the notification, to make sure all messages are received. Is this the way it’s done?
Posted
by aligned.
Last updated
.
Post marked as solved
6 Replies
374 Views
Right after I receive a notification I want to execute a background task. I'm using firebase to receive notification. I can receive notification successfully with 'UNUserNotificationCenter' in the AppDelegate file. Now my goal is to send a "GET" - "PUT" request, right after I received a notification (only when the app is in background) I saw the documentation about Background Tasks: https://developer.apple.com/documentation/backgroundtasks But I can't found a way to execute a background task right after I receive a notification. Is anyone has any suggestion about that? Thank you
Posted Last updated
.
Post not yet marked as solved
1 Replies
158 Views
We use remote push notification with content available = 1, as per document it will wake up app, but it doesn't work properly, sometimes the app doesn't wake up. I have observed this behaviour mostly on iOS 15. We use this mechanism to send device location to our server. Why remote push notification doesn't wake up my app all the time ?
Posted
by avartak.
Last updated
.
Post not yet marked as solved
0 Replies
138 Views
Apple recently introduced and presented Web Push, a new Web Kit tool permitting to send notifications to users on your websites and web apps. However, push notifications have been a thing on macOS since Mavericks. Therefore, what is the difference between these two things ?(https://developer.apple.com/notifications/safari-push-notifications/ ) and that new thing (https://developer.apple.com/videos/play/wwdc2022/10098/)
Posted
by Kwiky.
Last updated
.
Post not yet marked as solved
1 Replies
476 Views
I have implemented push notification and subscribe app on different news topics. When a silent push notification received i want my app to subscribe/unsubscribe the topic on type based. But problem i am facing is when app is in background code executed and hit the subscribe/unsubscribe code but app wont process it and as soon as i open the app i got message that topic has been subscribed/unsubscribe successfully. While in foreground code is executing and processing successfully. Background processing and Background fetch are enabled in background modes. My Code is as: func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) { if let messageID = userInfo[gcmMessageIDKey] { print("/// Message ID: \(messageID)") } if let topic = userInfo["topic"] as? String{ if let type = userInfo["type"] as? String{ do { if(type == "unsubscribe"){ Messaging.messaging().unsubscribe(fromTopic: topic) } else { Messaging.messaging().subscribe(toTopic: topic) } }catch{ } } } // Print full message. print("info = ", userInfo) Messaging.messaging().appDidReceiveMessage(userInfo) completionHandler(UIBackgroundFetchResult.newData) } My Headers from postman are apns-push-type:background apns-priority:10 and the body { "to" : "*** device token ***", "priority" : "high", "content_available": true, "data" : { "topic" : "Sports", "type" : "unsubscribe" // subscribe } } What i want is to subscribe/unsubscribe the fcm topics when app is in background and silent notification received.
Posted
by u_ali.
Last updated
.
Post marked as solved
6 Replies
445 Views
Hi Since yesterday, there seems to be a problem with APNS Sandbox. In dev mode, the token is never registered. (didRegisterForRemoteNotificationsWithDeviceToken & didFailToRegisterForRemoteNotificationsWithError never called) The logs below seem to indicate a certificate expiry. Can you please confirm? Mant thanks erreur com.apple.apsd stream Trust evaluation failed: Error Domain=NSOSStatusErrorDomain Code=-67818 UserInfo={NSLocalizedDescription=<private>, NSUnderlyingError=0x10de796b0 {Error Domain=NSOSStatusErrorDomain Code=-67818 UserInfo={NSLocalizedDescription=<private>}}} apsd 2022-06-15 09:11:07.839890 +0200 erreur com.apple.apsd stream Failed to authenticate with policy <private> apsd 2022-06-15 09:11:07.840023 +0200 erreur com.apple.apsd stream Trust evaluation failed: Error Domain=NSOSStatusErrorDomain Code=-67818 UserInfo={NSLocalizedDescription=<private>, NSUnderlyingError=0x10dd14a10 {Error Domain=NSOSStatusErrorDomain Code=-67818 UserInfo={NSLocalizedDescription=<private>}}} apsd 2022-06-15 09:11:07.974462 +0200 erreur com.apple.apsd stream Failed to authenticate with policy <private> apsd 2022-06-15 09:11:07.974642 +0200
Posted
by Alaman.
Last updated
.
Post not yet marked as solved
0 Replies
135 Views
I'm trying to log when a user gets a silent notification using didReceiveRemoteNotification. Here is my code right now: func application( _ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void ) { print("Log here") application.applicationIconBadgeNumber = 0 completionHandler(.noData) } Here is the payload.apns file: "aps" : { "content-available" : 1, }, "acme1" : "bar", "acme2" : 42 If i open Console.app application I can see that the (simulator in this case) wakes up in the background when I drag and drop the payload but it never runs the didReceiveRemoteNotification function. The app is written in SwiftUI and has a seperate AppDelegate file. The app is also using Firebase Analytics and I have tried to set the FirebaseAppDelegateProxyEnabled to "NO" (false). Am I doing something wrong? Note: The function gets called when the app is in the foreground and I drag and drop a normal alert notification (not silent).
Posted
by Rootin.
Last updated
.
Post not yet marked as solved
5 Replies
933 Views
Hi there, I'm seeing weird behavior when trying to register for push notifications in macOS development builds for any of my apps I'm calling registerForRemoteNotifications() on my NSApplication object but I never receive any callbacks in my AppDelegate. Neither didRegisterForRemoteNotificationsWithDeviceToken nor didFailToRegisterForRemoteNotificationsWithError is ever called. The code works perfectly in release builds where I receive the device token as expected in the delegate method. I'm getting the exact same behavior on two Macs (both running the latest Catalina version). My code signing settings are set to "Automatically manage signing" and my apps use Xcode managed Provisioning Profiles which include the "Push Notifications" capability and the "com.apple.developer.aps-environment" entitlement. Is this in any way a known problem?
Posted
by cbot.
Last updated
.
Post not yet marked as solved
9 Replies
731 Views
when i use NSURLSession have a https request,TLS always download server certificate,Instead of using cached certificates. Certificate related packages are as follows: 123 17.994520 106.53.111.71 192.168.199.159 TLSv1.3 1412 Server Hello, Change Cipher Spec, Application Data 124 17.994559 106.53.111.71 192.168.199.159 TCP 1412 443 → 65048 [ACK] Seq=1373 Ack=518 Win=30336 Len=1372 [TCP segment of a reassembled PDU]
Posted
by Bob16.
Last updated
.
Post not yet marked as solved
0 Replies
109 Views
In the actual test, we found that if a large number of push messages are sent to the APNs server in a short time, some push messages will be received at a long interval. Is there a good way to make a large number of push messages arrive on time?
Posted
by Bob16.
Last updated
.
Post not yet marked as solved
1 Replies
164 Views
I have downloaded my app through TestFlight and have allowed push notifications for my app through TestFlight. (as shown in the picture) I have used this: https://github.com/Altaibaatar/APNS-with-auth-key-p8-using-PHP to trigger push notifications to my app. Additional changes I have made to the code: using (production) https://api.push.apple.com/3/device instead of (development) https://api.development.push.apple.com/3/device. When I triggered the script, it returns a "200" status code but I have not seen any notifications. Is there anything wrong with the script I am running or have I missed a step to implement push notifications? Thank you in advance!
Posted
by kiraa.
Last updated
.
Post not yet marked as solved
1 Replies
564 Views
Hey, I have been trying to integrate fcm with my flutter app. It works fine on android but on ios it throws the following error: unregister notification for read_timeout failed, I have tried almost everything, can someone help me here?
Posted
by rish01.
Last updated
.
Post not yet marked as solved
1 Replies
480 Views
Hello everyone, every time i send a new version off my app i receiving an email with this warning. I'm using CODEMAGIC to build the versions because don't have macbook. ITMS-90078: Missing Push Notification Entitlement - Your app appears to register with the Apple Push Notification service, but the app signature's entitlements do not include the 'aps-environment' entitlement. If your app uses the Apple Push Notification service, make sure your App ID is enabled for Push Notification in the Provisioning Portal, and resubmit after signing your app with a Distribution provisioning profile that includes the 'aps-environment' entitlement. Xcode does not automatically copy the aps-environment entitlement from provisioning profiles at build time. This behavior is intentional. To use this entitlement, either enable Push Notifications in the project editor's Capabilities pane, or manually add the entitlement to your entitlements file. For more information, see https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/HandlingRemoteNotifications.html#//apple_ref/doc/uid/TP40008194-CH6-SW1. I'm realy want to use this service. I just mark the checkbox in "App ID Configuration". Just have created a APN key and send to firebase. I send message to apple, they say to search in forum, but there is no solution there. PS: I can't generate a certificate to put on the Push Notification because using codemagic and the VM changes every time i build a new version.
Posted Last updated
.
Post not yet marked as solved
0 Replies
98 Views
I am beta testing an app on TestFlight and using Wonderpush for push notifications. I have 22 requested beta testers but I have 68 registered Wonderpush users. Somehow, there are 46 push notification registered users from China that were not invited through TestFlight. I talked with Wonderpush technical support who indicated there is no way to be registered as a push notification user without downloading the app. Anyone else have this problem? Is it possible to download an app on Testflight without being invited?
Posted
by furicchio.
Last updated
.
Post not yet marked as solved
0 Replies
111 Views
Can we implement background activities for longer period of time after a silent push notification is sent?
Posted
by AyushiP.
Last updated
.