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
1 Replies
261 Views
Hello,I would like to ask about push notifications.If I want to send simultaneously e.g. 10 thousand push notifications, do I have this capability?Also, can push notifications interact with other apps? To explain this: If I want something to be done when a push notification is sent to another app, does Apple act as a middle man, or the other developer has to give me the tokens of his clients in order to send them the notifications directly?Thanks in advance!
Posted
by
pek
Post not yet marked as solved
5 Replies
5.3k Views
Hello,According to APNS documentation; (https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/sending_notification_requests_to_apns)Apple specificy the following api address when communicating with APNS;Development server: api.sandbox.push.apple.com:443Production server: api.push.apple.com:443I've tried both of these url's using port's 443 & port 2197 both not working with 443 always returning a connection refused error. My 443 & 2197 ports are open for inbound & outbound traffic.However, if I use the following url gateway.sandbox.push.apple.com:2195, everything works as expected.Can anybody provide any reason why the documentation does not specify what works?Thanks,James
Posted
by
Post not yet marked as solved
5 Replies
932 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
Post not yet marked as solved
4 Replies
821 Views
Hi, I want to ask is MDM push also not support legacy binary protocol as of November 2020? If not support, may I ask what the http2 header need to append for mdm push? Here is my header: {"apns-topic": 'com.apple.mgmt.External.xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx',"apns-push-type": 'mdm'} The post url is: api.push.apple.com:443/3/device/@deviceToken The mdm payload : { 'mdm':'@pushMagic' } And I always receive the BadDeviceToken, is something I mistake? Thanks.
Posted
by
Post not yet marked as solved
3 Replies
1.3k Views
On my iOS 14 Beta 3 device: I noticed that the TestFlight variant shows on device wakeup randomly the popup "App <my-app> has crashed, send log?". The app uses geofence in background so I tried to debug with Xcode 11, original source code and linked Device Support Files on the device. But each time I bring the app in the background via app switcher, the app is instantly get killed by the os. The device logs showed me the error Unable to move topic com.example.my-app, This topic was not in the list provided! APSTopicListOpportunistic I didn't find any results about APSTopicListOpportunistic, does anybody know something about this error? It seems to be related to APNS (by naming), but push notifications work fine and the moment is a bit confusing. But also warnings about file handles get instantly removed and access to them results in not an SQLite database: /var/mobile/Containers/Shared/AppGroup/3EAA8534-A594-4852-824B-D2D45C91D80B/default.realm So I commented out all code in applicationDidEnterBackground that previously invalidated timers, read a value from the realm database and stopped websocket connections. The errors are gone, but the debugger tells that the app gets still killed instantly Terminated due to signal 9 If it helps applicationWillTerminate is not being called. On iOS 13 the app was still active in background (verified via debugger), and I could reopen it to wake it up. Now it always gets cold-restarted. Thanks for your help or if you experience the same issues. Unfortunately I couldn't test if it also occured in previous iOS Beta versions.
Posted
by
Post not yet marked as solved
1 Replies
935 Views
We are entitled by Apple for critical alerts. Our app is an alerting app which shall now be used to alert deaf persons. We did not find the possibility to alert deaf persons, by choosing vibration instead of sound. The accessibility options of iOS don't seem to provide an option to choose vibration instead of sound. It does vibrate for a very short amount of time, but it must vibrate for at least 10-20 seconds to be of any help. Is there any possibility to vibrate upon receiving a critical alert notification for that amount of time? We're also using a notification service extension, but we're more interested in an official solution, than a "hack" solution.
Posted
by
Post not yet marked as solved
2 Replies
297 Views
Hello, from October we have started to do not receive responses of pushes sent to Apple servers. Last time it was day before yesterdeay from 14:00 to 14:30 , and today there are lots of pushes without responses from 14:25 and problem still continues. All time is Moscow time zone. Thanks, Zigurds
Posted
by
Post not yet marked as solved
9 Replies
2.9k Views
Dear developers, after a lot of phone calls with the Developer team at Apple I’m now trying to find my luck here. im a software engineer, developing apps for iOS and macOS for a couple of years. So for my latest customer who have an app already available on the App Store. They wanted me to develop an app update whilst the old developer did not agree to do so. Now at the end of developing I’ve tried to upload the update to the App Store. I’ve developed the app under my own developer account and finally changed it to the customer‘s one, including the change of the bundle identifier to prepare everything. At this Point, everything went well and I was still able to deploy the app with the new account and new bundle id to my physical devices. But when it comes to Archiving and Deploying the app to the store, I’m getting code signing errors (tried „Product -> Archive“ in XCode which is the normal way to upload an app). Here I need to enter my password for the macOS user, but the code signing error still appears. After lot of research I thought why not open up the Keychain Access App on macOS and delete the certificates that I’ve created (or were created automatically by the system/XCode when signing in with the customer’s developer account). Long story short: Keychain app crashes immediately after opening it. I’m not able to delete/create/manage any certificates. I don’t even get an error message, like the typical „app crash report“. even removing the account from XCode does not help. Some guys from Apple guided me through some commands while resetting and reinstalling macOS. Without re-adding the customer’s account, everything works fine with Keychain. But again, when adding the account to sign and upload the app, it repeats over and over. Apple told me that it’s likely not a problem with the customer’s account, but the above described things are really strange. What could be the problem? I am not able to upload the update to the Store and Keychain keeps crashing. Anybody here with a solution? some information: the app is already live, but the update fails. the customer’s account is a paid account All certificates and profiles you can create in the Console (like the one for APNS for example) are created and available to me The app is intended to run on iOS only (Not macOS) and uses the Flutter Framework thanks! Sebastian
Posted
by
Post not yet marked as solved
1 Replies
2.2k Views
Hi, everyone! I'm trying to do push notification for apple wallet pass via PHP. My code (in 2 variants) is below. According to guidelines - https://developer.apple.com/library/archive/documentation/UserExperience/Conceptual/PassKit_PG/Updating.html I should get the response in json format, but i don't. Anyway in the server logs I see the response 200. Any notification doesn't appear on the device. I also tried to push notification via command line tools, but also faced problems - the guideline - https://developer.apple.com/documentation/usernotifications/sending_push_notifications_using_command-line_tools give info only about push notification for your own app, not for the Wallet. I will be very grateful for any responses. №1 &#9;&#9;&#9;&#9;$apnsServer = 'tcp://api.push.apple.com:443/3/device/'; &#9;&#9; &#9;&#9;&#9;&#9;$privateKeyPassword = '<password>'; &#9;&#9;&#9;&#9;$message = 'test'; &#9;&#9;&#9;&#9;$deviceToken = &#9;&#9;&#9;&#9;'<token>'; &#9;&#9;&#9; &#9;&#9;&#9;&#9;$pushCertAndKeyPemFile = 'my.pem'; &#9;&#9;&#9;&#9;$stream = stream_context_create(); &#9;&#9;&#9;&#9;stream_context_set_option($stream, &#9;&#9;&#9;&#9;'ssl', &#9;&#9;&#9;&#9;'passphrase', &#9;&#9;&#9;&#9;$privateKeyPassword); &#9;&#9;&#9;&#9;stream_context_set_option($stream, &#9;&#9;&#9;&#9;'ssl', &#9;&#9;&#9;&#9;'local_cert', &#9;&#9;&#9;&#9;$pushCertAndKeyPemFile); &#9;&#9;&#9;&#9;$connectionTimeout = 20; &#9;&#9;&#9;&#9;$connectionType = STREAM_CLIENT_CONNECT | STREAM_CLIENT_PERSISTENT; &#9;&#9;&#9;&#9;$connection = stream_socket_client($apnsServer, &#9;&#9;&#9;&#9;$errorNumber, &#9;&#9;&#9;&#9;$errorString, &#9;&#9;&#9;&#9;$connectionTimeout, &#9;&#9;&#9;&#9;$connectionType, &#9;&#9;&#9;&#9;$stream); &#9;&#9;&#9;&#9;if (!$connection){ &#9;&#9;&#9;&#9;echo "Failed to connect to the APNS server. Error no = $errorNumber<br/>"; &#9;&#9;&#9;&#9;exit; &#9;&#9;&#9;&#9;} else { &#9;&#9;&#9;&#9;echo "Successfully connected to the APNS. Processing...</br>"; &#9;&#9;&#9;&#9;} &#9;&#9;&#9;&#9;$messageBody['aps'] = array('alert' => $message, &#9;&#9;&#9;&#9;'sound' => 'default', &#9;&#9;&#9;&#9;'badge' => 2, &#9;&#9;&#9;&#9;); &#9;&#9;&#9;&#9;$payload = json_encode($messageBody); &#9;&#9;&#9;&#9;$notification = chr(0) . &#9;&#9;&#9;&#9;pack('n', 32) . &#9;&#9;&#9;&#9;pack('H*', $deviceToken) . &#9;&#9;&#9;&#9;pack('n', strlen($payload)) . &#9;&#9;&#9;&#9;$payload; &#9;&#9;&#9;&#9;$wroteSuccessfully = fwrite($connection, $notification, strlen($notification)); &#9;&#9;&#9;&#9;$apple_error_response = fread($connection, 6); &#9;&#9;&#9;&#9;if (!$wroteSuccessfully){ &#9;&#9;&#9;&#9;echo "Could not send the message<br/>"; &#9;&#9;&#9;&#9;} &#9;&#9;&#9;&#9;else { &#9;&#9;&#9;&#9;echo "Successfully sent the message<br/>"; &#9;&#9;&#9;&#9;} &#9;&#9;&#9;&#9;fclose($connection); ?> №2 $apnsCert = 'my.pem'; $push_token = '<token>'; $passIdentify = '<pass identify>'; $payload['aps'] = array('alert' => 'Oh hai!', 'badge' => 1, 'sound' => 'default'); $output = json_encode($payload); $msg = chr(0) . pack('n', 32) . pack('H*', $push_token) . pack('n', strlen($output)) . $output . pack('n', strlen($passIdentify)) . $passIdentify; $streamContext = stream_context_create(); stream_context_set_option($streamContext, 'ssl', 'local_cert', $apnsCert); $apns = stream_socket_client("api.push.apple.com:443/3/device/", $error, $errorString, 2, STREAM_CLIENT_CONNECT, $streamContext); if (!$apns) exit ("APNS Connection Failed: $error $errorString" . PHP_EOL); var_dump($apns); if(fwrite($apns, $msg)) { &#9;&#9;echo "ok"; } else { &#9;&#9;echo "not ok ".error_reporting(E_ALL); } socket_close($apns); fclose($apns);
Posted
by
Post not yet marked as solved
1 Replies
1.1k Views
From the APNS documentation, - https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/handling_notification_responses_from_apns an error with error coded 410 will be thrown if a push token is no longer valid. However, Our company is seeing cases where stale push tokens (i.e. tokens that haven’t received any notifications in over 1 year) aren’t getting a 410 error back from APNS. Will APNS throw a 410 error for stale push tokens? What are the conditions under which a 410 error code will be returned?
Posted
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
by
Post not yet marked as solved
3 Replies
1.3k Views
We are experiencing an issue on several devices when attempting an enrollment to Mobile Device Management (MDM). The device is communicating, but it appears there is a problem with certificates that won't allow the enrollment to complete. Automated Device Enrollment (ADE, formerly DEP) enrollments do not work either. Failure to enroll in MDM is occurring on the following types of devices: Big Sur M1 Architecture Big Sur Intel Architecture Catalina Console log below of before, during, and after an attempt for MDM enrollment on a device experiencing this issue: language error 13:33:38.859611-0600 CertificateService Server capabilities lack support for 3DES but we're going to use it anyway error 13:33:39.240005-0600 CertificateService Error (-26275) decrypting response payload error 13:33:39.240183-0600 CertificateService ProcessRequestCertSignatureResponse: No certificate received error 13:33:39.240703-0600 CertificateService [ERROR] : [MDM_SCEP_Enroll] Calling SCEPCopyCertificate --  NSOSStatusErrorDomain:-25300 error 13:33:39.274025-0600 mdmclient [ERROR] PlugIn: InstallPayload [CertificateService] Error: Error Domain=NSOSStatusErrorDomain Code=-25300 "errKCItemNotFound / errSecItemNotFound:  / The item cannot be found." UserInfo={IsInternalError=true} error 13:33:39.292742-0600 kernel System Policy: WSDaemon(130) deny(1) file-read-metadata /private/var/db/ConfigurationProfiles/Store/ConfigProfiles.binary error 13:33:39.340017-0600 kernel Sandbox: coreaudiod(220) deny(1) file-read-metadata /Library/Keychains error 13:33:39.371452-0600 mdmclient CPProfileManager.installProfile returning error -25300 (private) error 13:33:39.392812-0600 kernel System Policy: WSDaemon(130) deny(1) file-read-metadata /private/var/db/ConfigurationProfiles/Store/ProfilePurgatory error 13:33:39.392968-0600 kernel System Policy: WSDaemon(130) deny(1) file-read-metadata /private/var/db/ConfigurationProfiles/Store/ProfilePurgatory/D1BA2076-4015-4062-BF9A-45474D415341_19975F4D-F21E-44C5-BC98-1F7F4A48AE70.mobileconfig.profilepurgatory
Posted
by
Post marked as solved
5 Replies
467 Views
I migrate apns to jwt token. On this page written https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/establishing_a_token-based_connection_to_apns. Similarly, APNs reports an error if you recreate your tokens more than once every 20 minutes. I check this case, i recreate new jwt, and encrypt, and send message with this encrypted token, on production url, then I repeat this several times. But where i can see this. APNs reports an error If i am... recreate your tokens more than once every 20 minutes. It'is can be blocked push after some time, or i just give report ?
Posted
by
Post not yet marked as solved
2 Replies
2.1k Views
Hi, I have Remote Push notifications managed by cloud messaging in Firebase. When I build my application from xCode, I do receive notifications on my device without issues and works as expected. But devices that have installed the app through TestFlight do not seem to receive the notifications. Is there a specific set up required to make it work on TestFlight and going ahead on App Store? Any advice or feedback in this regard is greatly appreciated. My versions: react-native: 0.60.5 react-native-firebase: 5.6.0 Testing on iOS devices: iPhone 6s and 7 with iOS version 14.1
Posted
by
Post not yet marked as solved
4 Replies
1.6k Views
Notifications for native apps was released in 2009. It's now 2021 and we still have no indication when Web App Notifications are being developer let alone released. Service Workers and Notifications are already built and working in desktop safari. Given that the majority of apps require some sort of notification to be useful, is the safari team currently developing this feature and what is the planned release date?
Posted
by
Post not yet marked as solved
1 Replies
295 Views
I am currently developing an app, where the user himself provides a data endpoint, that should send a push notification to his device, if this endpoint receives values higher than a specified number. The push registration takes place on his server as well as the sending of the notification. Since the certificate for sending these notifications is required to be bound to the app directly, the only way of doing this without hosting some type of middleware for notifications (which I would like to avoid), is by making the certitificate public. Is it generally allowed to do such thing and will my app stil be accepted to the AppStore if it is public?
Posted
by
Post not yet marked as solved
1 Replies
658 Views
Hello, after sending a PUT request to https://api.storekit.itunes.apple.com/inApps/v1/transactions/consumption/<my_original_transaction_id> I get a 401 - Unauthenticated Request ID: .... Any ideas why I'm getting a 401? Reading the docs there doesn't mention any sort of authentication parameters: https://developer.apple.com/documentation/appstoreserverapi/consumptionrequest Any ideas would be helpful, And apologies for the selected tags, I was unsure which tag to put this under. Thanks, Kurt
Posted
by
Post not yet marked as solved
0 Replies
226 Views
I've configured all the request permissions aspects and when permission is granted to my web app the device token is returned and I save that to my db. When I try and send a notification with this tool (https://github.com/onmyway133/PushNotifications) or from my serverside code with this library (https://github.com/genesluder/python-apns) using either token or certificate authentication APNS returns a 200 OK sent status. However, my Mac Mini (running BIG Sur) doesn't get the notification. There is nothing in the response from APNS indicating any kind of error so I have no idea how I can work out where the problem is. Any debugging advice would be welcome please.
Posted
by