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

Posts under APNS tag

200 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

Remote (background) notifications not arriving on macOS
I have an iOS and native macOS app that is configured to receive remote (background) notifications. I've verified that the background notifications are being received on iOS. I'm sending the notifications from my server, and my app also receives CloudKit notifications on iOS. But neither of these is received on macOS. I've found two recent discussions that indicate that other users are experiencing this problem: https://stackoverflow.com/questions/74868553/apple-push-notifications-arriving-on-macos-but-not-in-the-application-itself https://github.com/raivo-otp/macos-receiver/issues/15
2
0
398
Dec ’23
About ports to open to communicate with APNs
I'm an engineer at an MDM vendor. MDM push to devices via Apple Push Notification Service (APNs). According to the document below, port 5223 needs to be opened in order for the device to communicate with APNs. https://support.apple.com/ja-jp/guide/deployment/dep2de55389a/web https://support.apple.com/ja-jp/102266 https://support.apple.com/ja-jp/HT210060 Does this port need to be open for both in and out? Or should I only open out? in : APNs → iOS Device out: iOS Device → APNs
0
0
268
Dec ’23
"Invalid Certificate Signing Request" error prevents certificate renewal on Apple Push Certificates Portal site
When attempting to renew a certificate after December 18, 2023, an error may be displayed, preventing the renewal of the certificate. It seems that repeating the process multiple times can occasionally lead to success, indicating that there is no issue with the CSR file. This occurrence has been observed in multiple MDM services, including Intune, Work Space One, and various other MDM vendors, suggesting a malfunction with Apple's servers. We hope that this issue will be promptly resolved and fixed. Although unrelated to the previous issue, when pressing "Manage Certificates," it redirects back to the login screen instead of returning to the certificate list page. Please fix this so that it returns to the certificate list page.
7
1
1.9k
Jan ’24
location push service extension
I have recently been approved for the location push service extension. I do not have as much experience working directly in swift. I am trying to Implement so that when this Location Push Notification is received by the device it responds to the server with the current location. I have the proper APNS set up and have already been approved. Is there a step by step guide to help implement this feature.
2
0
504
Dec ’23
Delay in APNS push after device move from offline to online.
We send multiple pushes while the device is offline and when we get back online we expect to get the last one. Our understanding is that Apple store only the last push and it will be immediately delivered when we get back online. But in some cases we are not receiving this last push when we come back online. strange part is if we send one more push we receive the missed one and the last push we send.
0
0
226
Dec ’23
DeviceTokenNotForTopic
Some users couldn't receive push notifications, and APNS returned a 'DeviceTokenNotForTopic' error. Upon validation using Apple's tool, I found that some tokens are identified as VoIP push tokens, and some as Live Activity (LA) push tokens. When attempting to send a normal alert push using these VoIP/LA push tokens, it didn't work and returned a 'DeviceTokenNotForTopic' error. These tokens were obtained from Apple's delegate function 'didRegisterForRemoteNotificationsWithDeviceToken.' It's unexpected to receive VoIP/LA push tokens from this event, but this issue is occurring, and I've observed it specifically in iOS 17 users. This problem is not universal and is happening only for some users. Please take note that our app support VoIP Push, Live Activity Push and Normal Push notification. Could this be an iOS 17 bug? Any advice on this matter would be appreciated. Thanks.
1
0
1.5k
Dec ’23
How exactly do I get push tokens from a Live Activity that was started remotely?
In iOS 17.2+, we have a new feature that lets you use a push notification to start a Live Activity. The docs mention this: While the system starts the new Live Activity and wakes up your app, you receive the push token you use for updates. How exactly does this work? I don’t see any listeners/delegate methods that trigger when you receive a start event. Since I need to extract the push tokens from a specific instance, how do I get that instance? I can call Activity<MyType>.activities to see all running Live Activities, but assuming my end user has multiple instances running, how do I locate the instance that was started remotely?
2
0
652
Dec ’23
Registering for remote notifications not working on physical device
Hi there, There might be something obvious I'm overlooking, but I can't for the life of me figure it out. Any help or guidance would be much appreciated! I've enabled push notifications for one of my app identifiers (developer portal and provisioning profile appear to be correct, as does the entitlements file). On a simulator, when I call registerForRemoteNotifications(), I immediately get a callback from didRegisterForRemoteNotificationsWithDeviceToken. However, when I run my app on any of my physical devices, this method is never called. Nor is didFailToRegisterForRemoteNotificationsWithError. If I manually remove the aps-environment key and deploy to my device, then didFailToRegisterForRemoteNotificationsWithError is invoked with an expected error message. Any idea what I may have done wrong here? I'm using Xcode 15.0.1 and have tried an iPhone 12 (iOS 15.5) and iPhone 13 Pro Max (iOS 16.7.2). My development environment requires a VPN, but I've tried disabling the VPN in case that was an issue. I've also tried restarting the devices and toggling Wi-Fi, airplane mode, etc. My app does integrate with Firebase (not FCM though), but I added the FirebaseAppDelegateProxyEnabled NO option, just in case (this wouldn't explain why it works on Simulator though). Thanks for your help!
0
0
563
Dec ’23
Issue with APN entitlement on iOS - Xcode 15
I have been pulling out my hair the past day over this. I am adding push / remote notifications (using FCM) and running into an issue with the APN entitlement not being added to provisioning profile - using automatic signing. Now I am somewhat of a new / hobbyist developer but I'm sure I've covered all the bases: Have added (and removed and re-added) the capability in Xcode. Created (and recreated) the APN key in the developer portal (combined with Sign in with Apple) AppDelegate is fine FCM returns a device key without issue. Cleaned build folder and rebuilt app Despite this I am still getting "10.18.0 [FirebaseMessaging][I-FCM012002] Error in application:didFailToRegisterForRemoteNotificationsWithError: no valid *aps-environment" entitlement string found for application" error. Include is a screen capture of the automatically generated profile which seems to illustrate the issue. Any and all advice is greatly appreciated ;)
3
0
1.5k
Dec ’23
Issue with APNS Token Registration on iOS 16.7.1 - Firebase FCM Token Generated but Register Device Token delegate Not Called
I'm currently facing an issue with APNS token registration on iOS 16.7.1 specifically for iPhone 8+. I'm working on integrating Firebase into my iOS app for push notifications. Problem: The problem I'm encountering is that the didRegisterForRemoteNotificationsWithDeviceToken and didFailToRegisterForRemoteNotificationsWithError delegates are not being called at all, despite Firebase successfully generating the FCM token. Environment: Device: iPhone 8+ iOS Version: 16.7.1 Xcode Version: latest Swift Version: latest Firebase SDK Version: latest Observations: Firebase successfully generates the FCM token, indicating that the device is able to connect to Firebase Cloud Messaging. However, the standard APNS delegate methods (didRegisterForRemoteNotificationsWithDeviceToken and didFailToRegisterForRemoteNotificationsWithError) are not being triggered. This issue seems specific to iOS 16.7.1 on the iPhone 8+. I already tested on other iphone its work normaly. Steps Taken: 1.Ensured that APNS is properly configured in the Apple Developer Console. 2.Firebase is set up correctly, as evidenced by the successful generation of FCM tokens. 3. No relevant errors or warnings in the Xcode console. Question: Has anyone else experienced a similar issue on iOS 16.7.1 or with iPhone 8+ devices? Any insights or suggestions on how to troubleshoot and resolve this issue would be greatly appreciated. Thank you in advance for your time and assistance! Additional Information: If you need more information or code snippets, please let me know. If there's a more appropriate place to post this issue or if it has already been addressed, kindly guide me.
1
0
538
Dec ’23
APNS returns 200 - Device did not receive Live Activities update
Hello! Currently we are reviewing an issue whereby our users were obtaining Live Activities update, but somehow at the end, there were Live Activity updates that were not properly received by the device. For example: 20 Live Activity updates sent to device, 17 were properly received, however the last 3 were not properly received (as can be seen by the UI of it not updating). So far we have looked into a few root causes highlighted on the forums and on stackoverflow: Timestamp of APNS (every one of the APNS has a different timestamp) 200 is seen from the APNS side, which is why we were confused by the push notification did not arrive on the device side Looking into our logs, its unfortunately not covered enough to tell us when this had been received Some questions here: Is there a way we could log every Live Activity / Push Notification received from APNS? (for all scenario, app on lock screen, app in background) Anyway to track a push notification's lifecycle? I know the Push Notification Console tool is useful for debug usage, but we wanted to see if there's something similar for production usage as well.
0
0
477
Dec ’23
Can't register for remote notifications
I've got a code that was making a successful registration for remote messages a few weeks ago. Here's how it was looking like: func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { registerForRemoteNotifications(application: application) return true } func registerForRemoteNotifications(application: UIApplication) { UNUserNotificationCenter.current().delegate = self let authOptions: UNAuthorizationOptions = [.alert, .badge, .sound] UNUserNotificationCenter.current().requestAuthorization( options: authOptions, completionHandler: { _, _ in } ) application.registerForRemoteNotifications() } func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) { print(deviceToken) } A few weeks ago the didRegisterForRemoteNotificationsWithDeviceToken method was calling after registration, but now neither didRegisterForRemoteNotificationsWithDeviceToken or didFailToRegisterForRemoteNotification methods are called. Why could this happen?
0
0
323
Dec ’23
How to request new sandbox and production technical certificates signed by Apple Authority
Hello all, We are using APNs to send push notifications to mobile apps using token-based connection (using .p8 certificate) and the technical certificate signed by Apple authority (which we have included in our truststore) The technical certificate was retrieved from push.apple server using the following commands: Sandbox env echo -n | openssl s_client -connect api.sandbox.push.apple.com:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' &gt; /tmp/api.sandbox.push.apple.com.crt PRD env echo -n | openssl s_client -connect api.sandbox.push.apple.com:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' &gt; /tmp/api.sandbox.push.apple.com.crt Now, the time has come to renew the technical certificate before it expires ( validity period of 2 years), and we face the situation where we get the same certificate back from the push.apple server. √ /tmp [09:53] # openssl x509 -noout -text -in 'api.push.apple.com.crt' Certificate: Data: Version: 3 (0x2) Serial Number: 17:97:52:80:2d:4d:48:bb:e5:ed:25:94:49:da:6d:63 Signature Algorithm: sha256WithRSAEncryption Issuer: CN=Apple Public Server RSA CA 12 - G1, O=Apple Inc., ST=California, C=US Validity Not Before: Dec 19 17:22:50 2022 GMT Not After : Jan 18 17:22:49 2024 GMT Subject: CN=api.push.apple.com, O=Apple Inc., ST=California, C=US Subject Public Key Info: Public Key Algorithm: rsaEncryption RSA Public-Key: (2048 bit) We all know PRD releases do take time, and we expected new certificates to already be available on the push.apple server. Critical Problem: The PRD application will fail all our business use cases, as it will fail to successfully connect with Apple using a trusted SSL connection How can we proceed further? Thank you!
0
0
191
Dec ’23
macOS - Failed to Distribute - Invalid Code Signing Entitlements
Hi, I am trying to distribute my Flutter macOS app, but it fails systematically. The application works perfectly locally (in both Debug & Release modes). My application uses the com.apple.developer.aps-environment entitlement (Push Notifications). I set this entitlement to "production" everywhere (DebugProfile.entitlements, Release.entitlements & RunnerProfile.entitlements). I have macOS distribution provisioning profile. When I am running the 'Archive', I selected as destination: "Any Mac (Apple Silicon, Intel)". When I am trying to deliver the archive, I receive the following error: Invalid Code Signing Entitlements. Your application bundle's signature contains code signing entitlements that are not supported on macOS. Specifically, value 'development' for key 'com.apple.developer.aps-environment' in ... and this... for every single asset !! My configuration is: Flutter 3.16.2 XCode 15.0.1 Mac OS: Ventura 13.6.1 Hardware: Mac mini 2018 Any help will be more than welcome... Thanks in advance,
2
0
434
Dec ’23
Set Up Apple Push Certificate to Google
This is for Google Workspace to Apple Push certificates Finish APNS certificate setup Upload the certificate you downloaded from Apple File attached MDM_ Google LLC (Ent)_Certificate (3).pem  We uploaded the certificate received from the Apple Push Certificates Portal but keep coming up with an error message: The certificate didn't upload
3
1
835
Dec ’23
How Do I post APN??
I want to send APN to update a pass in the Wallet app. Followed this guideline. https://developer.apple.com/documentation/walletpasses/adding_a_web_service_to_update_passes#3733254 I tried with Typescript (Firebase Functions) like this. var path = "/3/device/"+pushToken var url = "https://api.push.apple.com:443"+path const response = await fetch(url, { method: 'POST', body: null, headers: { 'apns-topic': 'com.colorfull.walletPass', 'apns-push-type': 'background', 'connection': 'keep-alive' } }); Got this error. TypeError: fetch failed Tried with Flutter like this. var path = "/3/device/$pushToken"; var url = "https://api.push.apple.com:443$path"; Response resp = await post(Uri.parse(url), headers: { 'apns-topic': 'com.colorfull.walletPass', 'apns-push-type': 'background', 'connection': 'keep-alive' }, body: {}); Got this error. ClientException: Invalid request method, uri=https://api.push.apple.com/3/device/688a3d6bf83526f00f6fb3d8dd197578f665dea0eeba7aebbe68c61f06bad198 Obviously I'm doing it all wrong, but there is no clear guideline. How can I send APN??
0
1
391
Nov ’23