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

253 results found
Sort by:
Post not yet marked as solved
23 Views

.pem file gives ssl error

I previously create .pem file for voip push notification and it works without any issue. But when I try to create another .pem file same way as before it created the .pem file but throws ssl error I create the .pem file with this command openssl pkcs12 -in voip_services.p12 -out voip_services.pem -nodes -clcerts Error:OpenSSL SSL_read: error:14094418:SSL routines:ssl3_read_bytes:tlsv1 alert unknown ca, errno 0
Asked Last updated
.
Post not yet marked as solved
21 Views

APNS doesn't work for Private Distributed application

We are developing the Private Distributed application with Push Notifications support. APNs sending implementing via Firebase. Firebase has success statuses on sending notifications but app doesn't shows it. Don't you know what can be the problem? We think it can be because of Private Distributed application but we are not sure.
Asked
by nikanor.
Last updated
.
Post not yet marked as solved
62 Views

How to receive changes of push notification via ANCS

I'm trying to implement the apple notification center service (ANCS) and want to display notifications from our application, but sometimes we need to update our notification and in this case, we send new push notifications via APNS with the same apns-collapse-id, and on-device this push notification change correctly, but I expect that this changes will be sent via ANCS to my device, but iOS didn't send it. What did I do wrong? How I can replace/modify the push notification which was sent and receive these changes via ANCS on my device? p.s. We use FCM + APNS for sending push notifications. p.s.s I'm using use iPhone 12 mini with iOS 15.2
Asked
by SergeyNix.
Last updated
.
Post not yet marked as solved
27 Views

Testing macOS push notifications

Hi everyone, I am having some issues testing our macOS menu bar app that needs push notifications. I got to make the app ask for permissions but the device token is not being returned. I have tried so many ways approaching this but the delegate function that returns the device token is not getting called at all. I am using the AppDelegate lifecycle while my UI is using SwiftUI. I am running Xcode 12.5.1 (12E507) on macOS Big Sur 11.3.1. This other post had a similar question but no answer: https://developer.apple.com/forums/thread/673209 My next steps: upgrade to macOS Monterey and update my Xcode instance. Anyone that has done this who has tips, that will be awesome. Thank you!
Asked Last updated
.
Post not yet marked as solved
1.3k Views

Push notification from Apple wallet Pass doesn't appear on the phone

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);
Asked
by juljul.
Last updated
.
Post not yet marked as solved
255 Views

Must the APNs token for a location-query notification be handled differently than a normal push token?

Hi, I've successfully requested the entitlement for com.apple.developer.location.push with Apple. After creating all relevant provisioning profiles, Push Services Key etc. and verifying that a visible push notification arrives to my physical device I'm stuck when trying to send a location push notification to wake up my Push Location Service extension. I use Firebase FCM to trigger the Push Notification which returns me one of the two things: Success when I try to send a visible notification DeviceTokenNotForTopic (when I try to send a background notification) Invalid Argument - invalid registration token when I try to send a location push notification with the apn headers: apns-push-type --> location apns-topic --> <bundle-id-of-the-main-app>.location-query apns-priority --> 10 (also tried with 5) Is there anything missing to be able to send a location push-type notification? Can I reproduce this without FCM in a easy way via command-line? Thanks!
Asked
by fuzi.
Last updated
.
Post not yet marked as solved
41 Views

Apple Watch Icon Not Display on Notification

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!
Asked
by Codemis.
Last updated
.
Post not yet marked as solved
71 Views

Process Silent Push Notification when iOS app is in background

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.
Asked
by u_ali.
Last updated
.
Post not yet marked as solved
642 Views

App does not launch by data FCM

Hi all, We used to launch our app in background by a silent FCM push and the app will display a local notification or does other jobs. It works in general. However, in one case, a iphone SE2 at iOS15.0.1, the app does not launch when a push is got. Checking out the console log, we have: 16:12:40.559604+0800 dasd Submitted Activity: com.apple.pushLaunch.com.hkt-starhomecall.ios.app:92F900 at priority 5 <private> 16:12:40.559921+0800 runningboardd [daemon<com.apple.dasd>:100] handle lookup could not find a matching process 16:12:40.560240+0800 dasd Error obtaining RBS process handle: Error Domain=RBSRequestErrorDomain Code=3 UserInfo={NSLocalizedFailureReason=<private>} 16:12:40.561398+0800 dasd Adding a launch request (<private>) for application <private> by activity <private> 16:12:40.561577+0800 dasd Launch requests for <private>: <private> 16:12:40.561706+0800 dasd Daemon Canceling Activities: {( com.apple.pushLaunch.com.hkt-starhomecall.ios.app:58E563 )} 16:12:40.561836+0800 dasd CANCELED: com.apple.pushLaunch.com.hkt-starhomecall.ios.app:58E563 at priority 5 <private>! 16:12:40.561950+0800 dasd Removing a launch request for application <private> by activity <private> 16:12:40.565382+0800 SpringBoard cancelActivities: 1 activities were not found: <private> 16:12:40.568732+0800 runningboardd [daemon<com.apple.dasd>:100] handle lookup could not find a matching process 16:12:40.569402+0800 dasd Error obtaining RBS process handle: Error Domain=RBSRequestErrorDomain Code=3 UserInfo={NSLocalizedFailureReason=<private>} 16:12:40.571141+0800 dasd com.apple.pushLaunch.com.hkt-starhomecall.ios.app:92F900:[ {name: ApplicationPolicy, policyWeight: 50.000, response: {Decision: Absolutely Must Not Proceed, Score: 0.00, Rationale: [{[pushDisallowed]: Required:1.00, Observed:0.00},]}} ], FinalDecision: Absolutely Must Not Proceed} The dasd seems refused to launch our app somehow with a Rationale: [{[pushDisallowed] . What does that mean? And what can we do? P.S. my FCM payload would be something like didReceiveRemoteNotification: userInfo { aps = { "content-available" = 1; }; "gcm.message_id" = 1633942901629592; "google.c.fid" = ddjGQwTik02Fh6agnjGhWm; "google.c.sender.id" = 1056180720554; notificationRequest = "home.link.update.block.history.list"; payload = "{\"logCalls\":[{\"duration\":0,\"blockedCategory\":\"2\",\"otherSideNumber\":\"24268975\",\"blockedName\":\"\U96fb\U8a0a\U5ee3\U64ad\",\"callOrigninationDateTime\":1633942901605,\"recordedDuration\":0,\"callResult\":\"B\",\"callOriginationDateTime\":1633942901605}],\"notificationDeviceUuids\":[\"9ba61840-c573-46b7-af31-9f51d7f9ed41\",\"ef8a7828-4c07-4187-bd47-ef1cfb440dee\"]}"; } Regards, Charles Chan
Asked Last updated
.
Post not yet marked as solved
73 Views

Provisional Notifications - no device token

I have been following the official Apple documentation on how to set up notifications in my app: https://developer.apple.com/documentation/usernotifications/asking_permission_to_use_notifications I noticed there is this option .provisional, which doesn't ask the user for authorization, but instead it is granted right away and then notifications are delivered quietly to the notification center's history. So far so good, but once I am granted authorization for sending .provisional notifications, the callback with the DeviceToken does not fire. I have this method in my AppDelegate:    func application(     _ application: UIApplication,     didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data   ) {     let tokenParts = deviceToken.map { data in String(format: "%02.2hhx", data) }     let token = tokenParts.joined()     ManagementService.sharedInstance().storeDeviceToken(token: token)   } And it fires when authorization for normal notifications is granted, but it doesn't for the provisional notifications. So the question is—how can I deliver the provisional notifications if I don't have the device token? My plan was to do the following: ask for authorization to send provisional notifications on first app launch and send the device token to my server ask for authorization to send normal notifications some time later (let's say after a week or after completing some action in the app) EDIT: Found the problem—I was calling the same method to register for remote notification after being granted authorization for both provisional and normal notifications:    func getNotificationSettings() {    UNUserNotificationCenter.current().getNotificationSettings { settings in      guard settings.authorizationStatus == .authorized else { return }             DispatchQueue.main.async {       UIApplication.shared.registerForRemoteNotifications()      }           }   } In this case settings.authorizationStatus == .authorized is false for provisional notifications (even though they are always authorized...). So I just omitted checking of settings.authorizationStatus for provisional notifications and the device token is there.
Asked Last updated
.
Post not yet marked as solved
131 Views

Push Notifications Capabilities

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!
Asked
by pek.
Last updated
.
Post not yet marked as solved
67 Views

Notification displayed via Notification Service Extension doesn't display correctly if the iPhone is passcode protected and locked

I've got a notification service extension which is working as expected unless the user a) turns the passcode for the iPhone on and b) turns on Auto-lock and the iPhone is locked when a push arrives If auto-lock is turned on and the phone is locked but passcode is not turned on, then the notification is displayed as expected. The iPhone displays a notification with the top line being the name of the app and the second line saying "Notification", which is neither the content within the push payload, not what is being set as the content within the extension. There's no difference in behaviour of the extension when passcode is enabled. Adding logging to the extension I can confirm the content is being replaced and posted as expected: NSLog("Going to post notification title: \(notificationContent.title) subtitle: \(notificationContent.subtitle) body: \(notificationContent.body)") contentHandler(notificationContent) The notificationContent is as expected and is identical when passcode is on off. Why is the iPhone displaying the notification incorrectly if passcode is turned on and the phone locked?
Asked
by mungbeans.
Last updated
.
Post not yet marked as solved
79 Views

Silent Push Notifications doesn't work properly on iOS 15

application(didReceiveRemoteNotification: fetchCompletionHandler:) is not called in background upon silent push. The method is called only after the user manually opens the app. Anyone know how to resolve this? I'm currently on iOS 15.1.1
Asked Last updated
.
Post not yet marked as solved
341 Views

Embedded Binary Bundle Identifier: (null)

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?
Asked
by JohannesD.
Last updated
.
Post not yet marked as solved
61 Views

Notification Types Which?

Hi All, The notification types that I'm having a hard time deciding right now. I'm making an app for kids. I need to send a secret notification from the parents ' side to the app the child is using. I researched this, there are silent push notifications, i.e. background remote and other background process notification types. These are generally used to update the data when the app is not in use. I do not have such a situation, it is enough to receive a notification when the application is used. It could be the Notification Service Extension. We can discuss it. Bests, Serdar
Asked Last updated
.