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

227 Posts
Sort by:
Post not yet marked as solved
1 Answers
117 Views
For creating APNS certificate, we use a signed CSR from our MDM vendor which is a .plist file. We were using this for quite some years now. But currently APNS portal throws error saying invalid file type (as attached below) Is the Portal updated to support only .csr / .txt / .rtf? Can anyone help to use the correct file format. (P.S: Works if we edit the extension & upload it)
Posted Last updated
.
Post not yet marked as solved
0 Answers
35 Views
Notification to my app stopped working recently. According to the server response the message was delivered without errors but nothing is going through on device. We are using a Push Notification Key to send Notifications. I have recently migrated my account from Personal to Business. Not sure if that had an influence. I also did create a new key but that also did not make any difference.
Posted
by gbark.
Last updated
.
Post not yet marked as solved
1 Answers
67 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 Ninad V.
Last updated
.
Post not yet marked as solved
0 Answers
46 Views
My goal is to get the push notifications while I get the following error The following Swift pods cannot yet be integrated as static libraries when I run pod install . I have tried the foolowing methods. pod 'GoogleUtilities', :modular_headers => true pod 'FirebaseCoreInternal', :modular_headers => true I also tried with use_modular_headers! But it didn't work out. Could some one say a solution to this issue?
Posted
by tychons.
Last updated
.
Post not yet marked as solved
3 Answers
910 Views
I want to enable push notifications in my iOS app. I followed the resp. walkthrough as closely as possible. To test things, I tried the command line approach first like described here: https://developer.apple.com/documentation/usernotifications/sending_push_notifications_using_command-line_tools The APNS server responds with 200/OK, but no notification will ever arrive at my device. I definitely assume my request is correct; if I tamper with the device token (e.g. by altering its last digit), the server responds with 400/BadDeviceToken like one would expect. This is what I get from the APNS server: curl -v --header "apns-topic: $TOPIC" --header "apns-push-type: alert" --header "authorization: bearer $AUTHENTICATION_TOKEN" --data '{"aps":{"alert":"test"}}' --http2 https://${APNS_HOST_NAME}/3/device/${DEVICE_TOKEN} *  Trying 17.188.138.73... * TCP_NODELAY set * Connected to api.sandbox.push.apple.com (17.188.138.73) port 443 (#0) * ALPN, offering h2 * ALPN, offering http/1.1 * successfully set certificate verify locations: *  CAfile: /etc/ssl/cert.pem  CApath: none * TLSv1.2 (OUT), TLS handshake, Client hello (1): * TLSv1.2 (IN), TLS handshake, Server hello (2): * TLSv1.2 (IN), TLS handshake, Certificate (11): * TLSv1.2 (IN), TLS handshake, Server key exchange (12): * TLSv1.2 (IN), TLS handshake, Request CERT (13): * TLSv1.2 (IN), TLS handshake, Server finished (14): * TLSv1.2 (OUT), TLS handshake, Certificate (11): * TLSv1.2 (OUT), TLS handshake, Client key exchange (16): * TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1): * TLSv1.2 (OUT), TLS handshake, Finished (20): * TLSv1.2 (IN), TLS change cipher, Change cipher spec (1): * TLSv1.2 (IN), TLS handshake, Finished (20): * SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384 * ALPN, server accepted to use h2 * Server certificate: * subject: CN=api.development.push.apple.com; OU=management:idms.group.533599; O=Apple Inc.; ST=California; C=US * start date: Feb 8 21:41:22 2021 GMT * expire date: Mar 10 21:41:22 2022 GMT * subjectAltName: host "api.sandbox.push.apple.com" matched cert's "api.sandbox.push.apple.com" * issuer: CN=Apple Public Server RSA CA 12 - G1; O=Apple Inc.; ST=California; C=US * SSL certificate verify ok. * Using HTTP2, server supports multi-use * Connection state changed (HTTP/2 confirmed) * Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0 * Using Stream ID: 1 (easy handle 0x7fe09f80f200) > POST /3/device/49C52E009C0107AB0ACCF178703E32790B4F3F155E7897F1F4ABAA3B1D9170D8 HTTP/2 > Host: api.sandbox.push.apple.com > User-Agent: curl/7.64.1 > Accept: */* > apns-topic: de.nexoft.viveto > apns-push-type: alert > authorization: bearer eyAiYWxnIjogIkVTMjU2IiwgImtpZCI6ICJaTTNDR0hTVEQ5IiB9.eyAiaXNzIjogIjNaVzhDUVZEWUoiLCAiaWF0IjogMTYyOTI5NjI1NCB9.MEYCIQCXP7L0-v_wY8F_WGFuZ-phJomzyO-43k0b7Xl9dvosVwIhANErbCHYfnG5ccfKTl14BCEhyWbDzPZSSLkJrSaQhCSb > Content-Length: 24 > Content-Type: application/x-www-form-urlencoded >  * Connection state changed (MAX_CONCURRENT_STREAMS == 1)! * We are completely uploaded and fine * Connection state changed (MAX_CONCURRENT_STREAMS == 1000)! < HTTP/2 200  < apns-id: 4C4AF738-9624-4643-8F76-18FFAD630C4F <  * Connection #0 to host api.sandbox.push.apple.com left intact * Closing connection 0
Posted Last updated
.
Post not yet marked as solved
1 Answers
53 Views
I would like to know whether the following items can be implemented with swift and whether there are any restrictions on passing the Apple side inspection. Almost all of them are DND-related, but the part I understood is written in parentheses next to the function or function, and I want to know if it is possible if that function is used. I'm a beginner in swift development, so I can't find a solution with a search, so I'm writing this. Don't ring the phone Event catch O (CallKit) when making a call or during a call Turn off all notifications except for allowed first-party apps Send a notification when the company's app is in the background (shoot API communication) O Check whether the current phone is sound, vibration, or silent O (AVAudioSession) Forced switching of sound, vibration, and silence O (AVAudioSession) Turn off SMS notifications
Posted
by dehien.
Last updated
.
Post not yet marked as solved
3 Answers
153 Views
We have exactly the same issue that was posted in this article APNS portal not working | Apple Developer Forums https://developer.apple.com/forums/thread/698419 We downloaded the csr from our MDM to do the renewal of the cert, log into the apple push cert renewal portal, click to renew the cert. Choose the csr downloaded earlier but then the upload button just doesn't do anything at all. Page is not loading or showing any errors at all. Tried different browsers, different computers with the same result on all of them the page just doesn't seem to do anything.
Posted
by barberj66.
Last updated
.
Post not yet marked as solved
1 Answers
203 Views
All our applications listed below, once installed in padOS15 (iPad mini 6 15.4.1) are not receiving any remote push notifications. We built our apps in XCode13.2.1. I also tried to install the latest XCode13.3.1 in macOS Monterey, but I got the same problem. It has no problem when installed on different devices and versions. Our apps: CLOMO SecuredBrowser for iFilter CLOMO SecuredMailer CLOMO SecuredDocs CLOMO SecuredContacts This is how to replicate it: Start the app Press the home button and the app goes to the background I change the profile settings on our server-side Wait for the remote push notifications. (the remote push notifications are received on other devices but not on this device) Expected result: remote push notifications should be shown on the device. When I checked the console log, I found that com.apple.Preferences removed delivered notifications as shown below. SpringBoard [com.apple.Preferences] Removing delivered notifications
Posted Last updated
.
Post marked as solved
1 Answers
62 Views
I have a apns request where i specify expiration of 5 min. When the notification is raised device isn't online, and after getting device online after 2 min, i still don't get a notification. Ideally if i do get the device online after 5 min and not receive notification that's expected. If i remove the expiration all together and then do same steps as above, i always receive the notification. Here's a curl request i am making: curl -v -d '{"aps":{"alert":{"title":"Device Status","body":"some body"}, "badge":0}}' -H "apns-topic: com.app.app" -H "apns-priority:10" -H "apns-expiration:300" -H "authorization: bearer Token" --http2 https://api.development.push.apple.com/3/device/deviceId Any suggestion why this is happening when expiration is specified and any work around for achieving this
Posted
by Rajat_Sie.
Last updated
.
Post not yet marked as solved
8 Answers
4.6k 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 Answers
47 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 Answers
282 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 Answers
113 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 Answers
83 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 Answers
395 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) -&gt; 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 Answers
405 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 Answers
101 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 Answers
888 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
.