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 marked as solved
1 Replies
511 Views
Hi, is NSE working on Mac Catalyst? I easily made it work in my iOS target, but am struggling with Catalyst. I checked that the .appex is built and signed with valid profile. But using the same debug scenario (run main app, attach to pid of NSE, send push notification) doesn't seem to trigger the extension. Documentation is a bit confusing, Extensions seem to define NSE for iOS only (but in this document, is Mac tag containing Mac Catalyst?) UNNotificationServiceExtension says it's available for Mac Catalyst 13.0+ I have no clue where to look. Cheers, Jan
Posted
by
Post not yet marked as solved
0 Replies
322 Views
Hello, My iPad is restarting automatically after every 7 - 10 days. Under logs, there is one file called "panic-full" which appears after the restart. Enclosing the file details for your reference. Please see if anyone can support me to resolve this issue. Thanks
Posted
by
Post not yet marked as solved
1 Replies
443 Views
I am sending push notification using HTTP/2 to https://api.push.apple.com:443 api but I am getting Operation TimeOut error in response . Can someone help
Posted
by
Post not yet marked as solved
1 Replies
281 Views
I am trying to make a submission but after filling in all the boxes, I am receiving the following error: An error occured during submission. Please try again. I have tried multiple times now - can anyone help please? Oh, forgot to mention, I tried submitting with a field left empty and the text appears below that box to fix the issue. But my problem is that all boxes are filled and no errors beneath them.
Posted
by
Post not yet marked as solved
0 Replies
213 Views
I am trying to integrate push notification functionality which will send notifications from PHP script to ios applications. However, push notification is not working in the critical alert. This means, when the ios device is in silent mode, notifications are not coming up. The user gets the pop up to allow the critical alert but then it isn't working. I have used below code for PHP:: $apnsHost = 'gateway.sandbox.push.apple.com'; $apnsCert = 'pushcert.pem'; $apnsPort = 2195; $apnsPass = '123456'; $token = 'ECE62BE1B57D05CCB0A204F4B03D43267CE70489C150CBA72F249B10DC805417'; $payload['aps'] = array('alert' => 'Oh hai!', 'badge' => 1, 'sound' => 'default'); $output = json_encode($payload); $token = pack('H*', str_replace(' ', '', $token)); $apnsMessage = chr(0).chr(0).chr(32).$token.chr(0).chr(strlen($output)).$output; $streamContext = stream_context_create(); stream_context_set_option($streamContext, 'ssl', 'local_cert', $apnsCert); stream_context_set_option($streamContext, 'ssl', 'passphrase', $apnsPass); $apns = stream_socket_client('ssl://'.$apnsHost.':'.$apnsPort, $error, $errorString, 2, STREAM_CLIENT_CONNECT, $streamContext); if (!$apns) { echo "Error: $errorString ($error)"; } fwrite($apns, $apnsMessage); fclose($apns); I have done the below steps in IOS: 1> certificate set up 2> created delgate method Any help appreciated, thanks!
Posted
by
Post not yet marked as solved
1 Replies
918 Views
I am facing issue during pushing notifications to the app installed on my IOS(15 beta 5) device(iPhone12). Its working fine locally(in development) but when i configure the same in production( upload app to app store ) its not pushing the notifications to the device.
Posted
by
Post not yet marked as solved
1 Replies
320 Views
We are using APNS and FCM services to notify other users on our app for the messages posted by the users at One-One and Group Chat on our application. We are sending the notifications through Python API using FCM and APNS libraries. In few cases when app is in background notifications are not received by the device but we see the response as success along with message id being returned please find the attached details for reference. APNS notification payload: {'title': 'Bhonagiri', 'body': 'Ttyyedf', 'jid': 'jid@domain', 'content-available': 1, 'xml': "1XXXxxx url<CONVERSATION_TYPE xmlns='urn:xmpp:conversationType'>1</CONVERSATION_TYPE>1628750128263Ttyyedf", 'sound': 'default'} APNS notification response for the above message: {'multicast_ids': [3702581774227590477], 'success': 1, 'failure': 0, 'canonical_ids': 0, 'results': [{'message_id': '1628750130259539'}], 'topic_message_id': None}**
Posted
by
Post not yet marked as solved
0 Replies
320 Views
Xmarin.IOS Remote Notification Stop Working the remote notification stop working after after March 31, 2021. after we receive the below message the notification stop working Please see it : The HTTP/2‑based Apple Push Notification service (APNs) provider API lets you take advantage of great features, such as authentication with a JSON Web Token, improved error messaging, and per‑notification feedback. If you still send push notifications with the legacy binary protocol, make sure to upgrade to the APNs provider API as soon as possible. APNs will no longer support the legacy binary protocol after March 31, 2021. We send push notifications to Xamarin.iOS apps using Azure Notification Hubs , After a lot of checking we found some code become not work correct when use Hub.UnregisterAllAsync the call back not worked Please see the code we need your help. Thanks public override void RegisteredForRemoteNotifications** (UIApplication application, NSData deviceToken) { Hub = new SBNotificationHub (ApplicationParameter.NotificationConnectionString, ApplicationParameter.NotificationHubPath); Hub.UnregisterAllAsync (deviceToken, (error) => { **if (error != null) return; var tags = new List<string> { ApplicationHelper.GetTag () }; Hub.RegisterNativeAsync (deviceToken, new NSSet (tags.ToArray ()), (errorCallback) => { if (errorCallback != null) Console.WriteLine ("RegisterNativeAsync error: " + errorCallback.ToString ()); }); }); }
Posted
by
Post not yet marked as solved
0 Replies
480 Views
Apple state the following: Refresh Your Token Regularly For security, APNs requires you to refresh your token regularly. Refresh your token no more than once every 20 minutes and no less than once every 60 minutes. APNs rejects any request whose token contains a timestamp that is more than one hour old. Similarly, APNs reports an error if you recreate your tokens more than once every 20 minutes. On your provider server, set up a recurring task to recreate your token with a current timestamp. Encrypt the token again and attach it to subsequent notification requests. We use an Azure Function to send push notifications and a scheduled cron-like function to refresh the APNS server tokens. I originally had a problem because I didn't use a separate HTTP connection for each team ID, this caused some HTTP 403 InvalidProviderToken errors. I have multiple environments (Dev, UAT, LIVE) and disabled all but LIVE believing that they could be interfering with each other contributing to the #403 error. Each environment creates their APNS tokens every 51 minutes, each push from that environment uses that token until refreshed. Will Apple only accept the most recent token used in a push and therefore reject any tokens used on other environments until refreshed on that environment? For example, assuming each server starts up one minute after each other and sends a push every minute after 5 minutes... T+0:00 - DEV Booted, Refresh DEV Token (Token A) T+1:00 - UAT Booted, Refresh UAT Token (Token B) T+2:00 - LIVE Booted, Refresh LIVE Token (Token C) ... T+5:01 - Push on DEV (Token A) T+5:02 - Push on UAT (Token B) T+5:03 - Push on LIVE (Token C) LIVE will work because it has the latest APNS token (C), but would DEV and UAT be rejected with a 403 because the token isn't the latest, or would all three work because the lease of the token is supposed to last 60 minutes? In other words if a push uses a new token does that invalidated all other tokens? Very much related, presumably I would then hit 429 TooManyProviderTokenUpdates as the three environments could startup at the same time and attempt the refresh in the first minute violating the 'no more than 20 minutes' rule? I believe the Sandbox and LIVE APNS environments are okay to refresh at the same time. Kind Regards, Rob.
Posted
by
Post not yet marked as solved
0 Replies
197 Views
Hi all, I have an issue that I've been stuck on for the past week. https://stackoverflow.com/questions/66975932/how-to-show-a-local-notification-in-flutter-when-the-app-is-in-background-termi I'm using FCM with AWS SNS and I'm having the exact same problem that was posted in this link except its with ios. The solution mentioned in the link worked for Android (sending type data). However, this solution does not work for ios as type data for some reason is not received in the frontend without including type notification as well. And when type notification is included it sends an automatic push notification in the background (which is what I don't want).
Posted
by
Post not yet marked as solved
0 Replies
258 Views
I've got same permission to enable the Notification but it shows up only when accessed it in Development. After I've pushed the app to production, the Permission alert didn't show up. Can someone share what are the exact steps to have notifications enabled in production mode? Also if need to configure xCode with specific details especially related to the certifications in the code signing part, please share with me to compare.
Posted
by
Post not yet marked as solved
0 Replies
268 Views
Hi Team, I was working on ANCS. I have gone through the apple developer forum on the ANCS. Where ANCS is intended for Notifications and also can able to handle accept/reject call operations. But using IOS_14 iphone 8 i can able to disconnect an active call using ANCS client. But i could not able to disconnect an active call in IOS_12. I would like to know that did apple gave any fix in IOS_14 for ANCS call related functionality? Please let me know the reason for it, so that we can conclude to out customers. Hoping for a quick reply. Thanks, Venkatesh Dyagala
Posted
by
Post not yet marked as solved
0 Replies
233 Views
I am developing a mac os application with electron. Is there a way to get device token for apple push notification? Is it possible to receive push notification in electron app?
Posted
by
Post not yet marked as solved
0 Replies
298 Views
I am trying to test my app on my own device and i need to enable push notification. for that i need to enable it on APNs on my developer account profile. my question here is , do i need to have a paid membership to test on my own device ?
Posted
by
Post not yet marked as solved
3 Replies
1k 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
by
Post not yet marked as solved
2 Replies
954 Views
Based off the Apple documentation, I expected to see that the notification with the highest relevance score was featured in the Notification Summary. However, when sending several notifications from a single app with the new relevance score field, I am consistently seeing the most recent notification be featured in the Summary — not the one with the highest score. I am using Xcode 13 beta 5 and a device running iOS 15 beta 6. This is the sample payload sent via APNs (with the relevance score being updated between sends): { "aps": { "alert": { "title": "Relevance score: 0.4", "body": "body text here." }, "interruption-level" : "active", "relevance-score" : 0.4 } } I have also confirmed that the UNNotificationContent object has the relevance score field populated with the expected double when receiving the push on the device.
Posted
by
Post not yet marked as solved
0 Replies
367 Views
I've deployed couples build to appstoreconnect after integrating push notification by using: /zo0r/react-native-push-notification But the new build disappeared without any issues, I don't know what is going and what is the root cause because I didn't see any email send to my email if the app got any issue need to fix. Checked: Followed instructions on the readme file. Entitlements are there Certs are good Provisioning profile is good App archived and deploy successful hint: I tried switching the branch without push-notification then submit a new build and it's appearing.
Posted
by
Post not yet marked as solved
0 Replies
263 Views
Like WhatsApp, i want to insert my incoming message in local database when notification arrives in all states like terminated state also without click on notification. My FCM payload is { "message": { "token": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "apns": { "headers": { "apns-priority": "10" }, "payload": { "aps": { "alert": { "title": "From Name", "subtitle": "Group Name", "body": "Message Text" }, "sound" : "default", "mutable-content" : 1 } } } } } i am able to receive notification in terminated state also, but i want to invoke my app's code when notification receives like whatsapp. i am using flutter, fcm.
Posted
by