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
0 Replies
135 Views
Silent Push Notification is not received to the device. I am sending push notifications from the https://fcm.googleapis.com/fcm/send Request Payload: { "content_available": true, "apns_priority": 10, "data": { "title": "Title of the notification", "body": "This string has message", "deviceId": "f565fa30-b5b2-11ec-bb6c-79ad60e4f707" }, "registration_ids":[ "List of registered devices"] } Now when I send the notification. I am getting the notification randomly on the devices. I was sending notification to 5 devices. Now 3 devices were receiving the notification and 2 device didn't received. When the app is running in the foreground I am getting notification in all devices. When app is in background I am getting notifications. When app is killed by the user and even phone is locked I didn't receive any notification in couple of devices and received in other device. Now, when I open the app I immediately received the notification. I read an article from apple doc on silent push notification and there it is clearly mentioned that there is no guarantee of notification delivery to the device. I cannot use normal notifications because I am filtering data before the notification. If payload have device id which is equal to stored device id then I fired a local notification if not then notification is silent. Any solution for this issue?
Posted Last updated
.
Post not yet marked as solved
1 Replies
500 Views
I have an iPhone & iPad app that does not contain an Apple Watch app. When the app receives a push notifications, and my phone is locked, I receive the notification on my Apple Watch. However, the image in the notification is missing: When I swipe down on the watch, the image is also missing on the received notification. On the phone, the icon displays correctly. My watch is a Series 5 (44mm) A2095. Below is all the icons present in my asset catalog. Please help!
Posted
by Codemis.
Last updated
.
Post not yet marked as solved
0 Replies
143 Views
I am using push kit and call kit to send VOIP notificatin from my server to my app. The notification's working fine, however it remains there for infinite time unless the user rejects or accepts the call. Is there any way to handle this? Like it automatically expires after 20 seconds.
Posted Last updated
.
Post not yet marked as solved
0 Replies
219 Views
Dear apple developer community... I am facing the problem on creating my own pushPacakge and .p12 webpush certificates file for safari push notifications. I follow all steps carefully on an official document here with my team. And also try to follow some tutorials on some blogs which corresponding to its. But it still doesn't work. Here's how my problem looks like I've got .p12 file then I've test to upload it into some push service like oneSignal, truePush and etc. It's able to upload the file but the push service still doesn't work. But if I used a provided .p12 from their service, the notification will working properly. I try to use my .p12 to generate a push package (pushPackage.zip). But the api log on my webServiceUrl keep showing me "{ logs: ['Signature verification of push package failed'] }". Even if I try all versions of AppleWWDRC (G1-G6) downloaded from here. And even I use an official php script (createPushPackage.php) file from apple apn document downloaded from here on the top right corner at companion file Here's what I've done so far to get my own .p12 file... Generate my own CSR file from mac keychain application Noted1: My appleId on my mac is an Admin role only on apple developer account (Not a Admin, Account Holder role) Noted2: I've try to enter an apple id with role Admin, Account Holder on a User Email Address field but it still doesn't work Login into an apple developer account console on apple developer site Go to identifier tab and create new webPushId identifier Enter description and webPushId(reverse domain name style which is web.com.herokuapp.kkwebpush) Come back to certificates tab and create new certificate (select webPushId radio button and click create) Choose webPushId that already created on step 4 from dropdown list then click on continue Upload CSR file that generated on step 1 into its Download .cer file Click on the downloaded .cer file from step 9 and generate .p12 file by keychain Here's how I create pushPackage.zip file Create folder to store all files needed ( reference from here ) which are AppleWWDRCA.cer Certificates.p12 (Generated from step 9 above) createPuchPackage.php (Official script from apple which already edit the path to Certificates.p12 and enter private key match with my Certificates.p12 password) intermediate.pem (Generated from export AppleWWDRCA.cer on keychain as intermediate.pem) pushPackage.raw (folder that contain both icon.iconset and website.json that already set matched webPushId and webServiceUrl inside website.json) So, the folder structure now look like this Then I start to run php createPushPackage.php inside this folder. After that I've got an unreadable format result on my terminal .But I still get a pushPackage.zip file stored at /tmp folder (At this point I think it might be fine with that unreadable format) . Head over to my tmp folder to move that pushPackage.zip file into my webServiceUrl endpoint directory for send a pushPackage when apple api model was called on window.safari.pushNotification.requestPermission ( Already set these 4 parameters below) url as my web service url to my endpoint websitePushID as my web site id registered on apple developer console userInfo as empty object {} callback as function as a callback function FINALLY MY FINAL QUESTIONS ARE... Are there any steps that I've missed? Why I keep getting { logs: ['Signature verification of push package failed'] } on my web service url log errors endpoint? Does my certificate is invalid? (If yes, what are all possible causes) Why I can't use my own .p12 file on other push services (oneSignal, truePush and etc.) that support custom upload .p12 file for safari push notification? * When I used a provided .p12 from their service, everything works fine (safari permission popup can appear). On the other hands, If I use my own .p12, I can upload its to their services but safari permission popup don't show up)? Any solution please? Thanks
Posted Last updated
.
Post marked as solved
1 Replies
821 Views
Hi community, my existing ui-tests did test push-notification interactions. Since upgrading to Xcode 13 those tests fail when tapping a by the generic tap via XCUIApplication(bundleIdentifier: "com.apple.springboard").otherElements["Notification"].firstMatch.tap() this is the error I get *** -[__NSArrayM insertObject:atIndex:]: object cannot be nil (NSInvalidArgumentException) actually the push notification is visible and can be queried in the debug console. just tapping it, crashes the test. I`m testing this with a real device (iPhone X, iOS 15). Testing on a iOS 14 device still works. Did anyone else face this problem or solve it? Thanks you
Posted Last updated
.
Post not yet marked as solved
0 Replies
143 Views
Hi, I have a project to deploy captive portal for public internet access. With all the other devices is working fine (PC/Android/Ipad/Mac) except for IOS devices. IOS devices takes around 45 seconds to show the Captive Network Assistant (mini browser).  I am attempting to use the new captive network DHCP advertisement in option 114 as described here: https://developer.apple.com/news/?id=q78sq5rv to reduced this delay. But It appears that in the first attempt it uses the old method and makes an GET to http://captive.apple.com/hotspot-detect.html. However, if I rejoin the same network a second time (without forgetting the network inbetween) it uses the new DHCP option 114 and opens the captive portal as described in https://developer.apple.com/news/?id=q78sq5rv. Any idea o what is happening?
Posted Last updated
.
Post not yet marked as solved
0 Replies
185 Views
Hello, I've implemented Notification Service Extension as well as push notification in my app. I choose Notification Service Extension as the scheme and then run the whole project. The main app runs well. But when I send a message to my device, I immediately see an alert banner poping up. The content in it has not been modified, which indicates the Notification Service Extension does not work. Also I didn't see any logs printed out from the notification extension. At the meantime, below error messages have been printed out on console under the name of "TestAppPushNotificationExtension" **2022-04-22 00:20:14.818476-0700 TestAppPushNotificationExtension[3594:131852] Bogus event received by listener connection: <dictionary: 0x24e1cbb20> { count = 1, transaction: 0, voucher = 0x0, contents = "XPCErrorDescription" => <string: 0x24e1cbcb8> { length = 18, contents = "Connection invalid" } } 2022-04-22 00:20:17.797906-0700 TestAppPushNotificationExtension[3594:131852] [lifecycle] WARNING: Did not receive handshake message from the host after waiting ~2 seconds. THIS MAY BE A SPURIOUS LAUNCH OF THE PLUGIN due to a message to an XPC endpoint other than the main service endpoint, or the CPU is highly contended and this extension or its host is not getting enough CPU time. ** I've followed this article(https://www.amarendrasingh.com/swift/notification-service-extension-not-working/) and tried every recommended way to debug. But I still didn't find a way to resolve it...
Posted
by angellan.
Last updated
.
Post not yet marked as solved
0 Replies
165 Views
Hello everyone! I am trying to implement push notifications in my WatchOS app. I have created the delegate class that handles the registration for remote notifications and that allows me to obtain the device token. Then I take the token and send it to Firebase, like this: func didRegisterForRemoteNotifications(withDeviceToken deviceToken: Data) {     FirebaseApp.configure()     var ref: DatabaseReference!     ref = Database.database().reference().ref.child("/")     let tokenParts = deviceToken.map { data in String(format: "%02.2hhx", data) }     let token = tokenParts.joined()      if let userID = UserDefaults.standard.object(forKey: "id") as? String {         ref.child("users/\(userID)/token").setValue(token)     } } Then I am using a Python Script to communicate with APNS. I am using the http library to get access to HTTP2. This is what I have got: payload = { "aps" : { "alert" : { "title" : "Hello Push", "message": "This is a notification!" }, "category": "myCategory" } } dev_server = "https://api.sandbox.push.apple.com:443" device_token = "9fe2814b6586bbb683b1a3efabdbe1ddd7c6918f51a3b83e90fce038dc058550" headers = { 'method': 'POST', 'path': '/3/device/{}'.format(device_token), 'autorization': 'bearer' + 'provider_token', 'apns-push-type': 'myCategory', 'apns-expiration': '0', 'apns-priority': '10', } async def test(): async with httpx.AsyncClient(http2=True) as client: client = httpx.AsyncClient(http2=True) r = await client.post(dev_server, headers=headers, data=payload) print(r.text) asyncio.run(test()) I have also downloaded the .p8 auth key file. But I don't really understand from the Apple Documentation what I have to do with it. What is the provider token in the headers? Am I doing the right thing with the token I receive from didRegisterForRemoteNotifications?
Posted
by tmsm1999.
Last updated
.
Post not yet marked as solved
0 Replies
107 Views
We've observed a steady decline in the number of responses to APNS requests coming back with the "Unregistered" reason. Since about the beginning of 2022, we've noticed that "Unregistered" responses have dropped off altogether for the oldest device tokens recorded in our backend. Going by the APNS response status, it would appear we're still successfully sending messages to these very old device tokens, but this seems counter intuitive. We would expect the opposite, that over time those oldest device tokens would be the ones most likely to no longer be active (i.e. app uninstalled, devices no longer in use, etc.). Many of these devices tokens were recorded years ago, so we find it hard to believe that none of them would be inactive now. Does APNS stop providing meaningful response status for device tokens at some point? For example, if the device is no longer reachable (not working, never powered on or connected, etc.), would a request to send a message to that device still have a "Success" response? And if so, is there any way to determine if those device tokens are truly inactive or not?
Posted Last updated
.
Post not yet marked as solved
1 Replies
149 Views
Hi Every one. Need some help interpreting this: I have set the background modes and remote notifications in info plist. Looking at the console logs, message arrives to the phone but it doesnt seem to wake the app. The following info shows up. I am not able to understand The rationale : PushDisallowed. Can any one throw some light on what could be the cause for it. I have ios 15.3 installed: [ {name: ApplicationPolicy, policyWeight: 50.000, response: {Decision: Absolutely Must Not Proceed, Score: 0.00, Rationale: [{[pushDisallowed]: Required:0.00, Observed:1.00},]}}  ], FinalDecision: Absolutely Must Not Proceed}
Posted
by ameruva.
Last updated
.
Post not yet marked as solved
0 Replies
167 Views
Hi, I have followed the instructions as per the documentation, and I am able to generate a pushPackage successfully. It seems to be only working on my safari browser, i.e. it asks me for the permission and upon granting the permission I do get a deviceToken. But when we try to visit the same site on my colleague's safari browser, it gives a permission denied in browser console, while the logs show "Signature verification of push package failed" Has someone else faced this issue before?
Posted
by asdaqweq.
Last updated
.
Post not yet marked as solved
2 Replies
1.5k Views
Hi, I'm trying to build a Notification Service Extension. When I run the application, I get the error: Embedded binary's bundle identifier is not prefixed with the parent app's bundle identifier. Embedded Binary Bundle Identifier:(null) Parent App Bundle Identifier: ##.#####.##### I have no idea why the identifier of the embedded bundle could be null. In the General tab of the extension, I have set it so that it has a common prefix with the parent app. In the Info tab, the value for Bundle Identifier is $(PRODUCT_BUNDLE_IDENTIFIER), and I cannot change that to anything else. Whenever I build, it goes back to this. Xcode Version 13.0 Any ideas?
Posted
by JohannesD.
Last updated
.
Post not yet marked as solved
0 Replies
145 Views
1 'Apple IST CA2' (an intermediate certificate) issued by 'Geo Trust' expires this month. The issuer of the next intermediate certificate after this one is 'AAACertificateServices', is it right? reference Page: https://developer.apple.com/news/?id=7gx0a2lp 2 I want to test in my staging environment. I want to an intermediate certificate issued by 'AAACertificateServices' for this purpose. Please let me know the site where I can download it.
Posted
by ry_iizuka.
Last updated
.
Post not yet marked as solved
0 Replies
94 Views
2022-05-12 12:24:31.588027+0530 ACGTNT[25332:1668013] Using APNS Notification 2022-05-12 12:24:31.617810+0530 ACGTNT[25332:1667707] Push Plugin register failed
Posted Last updated
.
Post not yet marked as solved
0 Replies
98 Views
I am getting Missing Push Notification Entitlement warning though my app doesn't use it. I have gone through multiple solutions related to this but none helped my issue. By the way, i have built the app using react native. I don't want to enable push notification service as I am not going to use it in my app. Any help would be appreciated to fix this warning. Note: I have already gone through the below URL. Not helped. https://stackoverflow.com/questions/32251123/missing-push-notification-entitlement https://stackoverflow.com/questions/66280782/missing-push-notification-entitlement-even-with-aps-environment-entitlement-set
Posted
by principio.
Last updated
.
Post not yet marked as solved
0 Replies
235 Views
When a user receives a provisional notification they are given an option to keep receiving notifications or stopping then. If they tap "Keep" they use to get asked if they want them to be delivered prominent or quietly. Well, in iOS 15 (Xcode 13) my users are not getting that choice and the notifications are stuck in "delivered quietly" unless the user happens to change that in their Settings. This defeats the purpose of provisional notifications and I have to go back to the old way which causes the user to be interrupted in the app when I have to ask permission. I am guessing its related to the new Summary feature that recently got added by Apple. What's going on here, Apple?
Posted
by hotngui.
Last updated
.
Post not yet marked as solved
1 Replies
94 Views
I have some questions about how to set up our MDM product for our clients to use. My first question is: with our MDM product, which will have different installations for different clients, does each installation of our product need a different CSR and CER? Thank you, Andrew
Posted Last updated
.
Post marked as solved
1 Replies
115 Views
Hello, I'm trying to find a way to send notifications to the devices my app is installed on, but I can't find a way to do this using PHP. Could you help me find an article or something to understand how to implement this into my app (in PHP)? Best regards, Alex Sofonea
Posted Last updated
.
Post not yet marked as solved
0 Replies
101 Views
Hi, I am using Houston library on Ruby on rails (http://www.rutionrails.com/blog/2017/3/20/houston-we-have-apple-push-notifications) to send Apple Notifications (APNS) using "gateway.push.apple.com". Last week, notifications was not received by users. Today, notifications are working again. However, ANPS status seemed to be good : https://www.apple.com/support/systemstatus/ I just would like to know if there were a problem from Apple server / gateway.push.apple.com the last days. Thank you,
Posted
by Arthur447.
Last updated
.
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 Last updated
.