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

APNS Documentation

Pinned Posts

Posts under APNS tag

252 Posts
Sort by:
Post not yet marked as solved
0 Replies
280 Views
Hello, Scenario: My app is running in the foreground, logged into my backend server and I have registered for push notifications and received a push token. I have pin code activated on the phone. I make some code changes and re-flash it in Xcode, the app is running in debug mode wired to Xcode. I put the app in the background and lock the screen and wait 30 sec until data protection is activated and the keychain cannot be accessed. I send a push notification. In this case didRegisterForRemoteNotificationsWithDeviceToken if often called with the same push token as I had before. Data is protected in this state, hence I cannot access the auth token and send the token to the server. In this case it is not needed since the token is the same, but it got me a bit worried. In didRegisterForRemoteNotificationsWithDeviceToken I send the push token to the server, as the Apple docs recommend. My concern now is: could didRegisterForRemoteNotificationsWithDeviceToken be called in a real scenario when the phone is locked and data protection is activated? The Apple docs say: Device tokens can change periodically, so caching the value risks sending an invalid token to your server. And gives an example: For example, UIKit calls the method when the user launches an app after having restored a device from data that is not the device’s backup data. In this case, since the user is initiating it, the phone is unlocked so data should be unprotected. But that is one example, what more scenarios could there be that triggers this function, and could data be protected in those scenarios? I'm worried that it could be triggered, even if its rare, in a state where data protection is activated, hence I cannot send the new push token to the server, and thus future remote notifications from the server will not be received by my app until the users logs out and logs in again.
Posted
by codenea1.
Last updated
.
Post not yet marked as solved
0 Replies
237 Views
I'm trying to implement a unique Id for each pass that someone adds to their wallet. Something like a unique membership Id or even something as simple as displaying a unique username. What is the process of setting this up? I already have everything set up to generate the pass and update the values of the pass fields, but how can I make this specific to a single pass? I feel like I have everything I need to support this but not sure of the workflow I should use. I found this endpoint: https://developer.apple.com/documentation/walletpasses/return_a_personalized_pass but unsure what the personalizationToken is or how I'd provide this. Is this the same as the "pushToken"? It also references this: https://developer.apple.com/documentation/walletpasses/personalizationdictionary/requiredpersonalizationinfo which seems to require previously entered user information.
Posted
by gonzosan.
Last updated
.
Post not yet marked as solved
0 Replies
300 Views
Hi Team, We are facing issues about VOIP call for some users in USA who used the Wi-Fi network of some service provider. They are not receiving the calls on Wi-Fi but able to receive the call when connected to SIM/Data Connection. We implemented the VOIP services of apple and VOIP notification received and call kit UI displayed. Its working fine on public network mostly but not working on some Wi-Fi network in USA. iPhone 12 Latest iOS version VOIP notification not received Call kit not display App Name=> Owwll
Posted
by almas542.
Last updated
.
Post not yet marked as solved
1 Replies
273 Views
HI all need urgent help here, so I have configured my router (enterprise company router) a hotspot and this as normal process, now, I am having difficult time for apple product to redirect this captive portal I configured, seems windows Android device directs me to the login page I need to be connected and then I register my credentials for internet use. when using apple products, I connect to the same hotspot but nothing happens the redirection does not havppens on Https ? if I put the whole https address in my safari while connected to the hotspot that takes me to where I need to be but It wont redirect as the other products I have tried to reset browser both Iphone 15 pro max 17.3.1 and MacBook Pro 14.3.1 If I use https://abcde.companywifi.com/portal?GatewayID=145&proto=https it will not work because it has the https in it? If I use without the https and just http://abcde.companywifi.com/portal?GatewayID=145 that works fine and auto directs as soon as I am connected to the hotspot but I dont want that I want secure connection and has to be Https connection
Posted
by mobahnan.
Last updated
.
Post not yet marked as solved
0 Replies
215 Views
If a server is sending a push to an app, then how can it know whether it should be sending the push using the Apple sandbox push server, or the production server? If the app is on the app store or testflight then it needs to be using the sandbox server, but if the app is being run via XCode interactively as devs are developing/testing then the push needs to be sent via the sandbox server. But the server itself has no idea if the app was installed via Testflight/app store/XCode/ or a development .ipa. So the server can't know how to send the push. The app has to send the push token to the server anyway, so the app could inform the server which environment it should be sent over. But then how can the app detect that itself? A naive answer is to use #ifdef DEBUG to detect this, but that is incorrect. Which environment a push should be sent over is not correlated with that. For example an app could be being run with a debug scheme or a release scheme, but in both cases if the app is installed/running via xcode then the push environment has to be the sandbox. So my question is, is there a way the app can detect which push environment a push should be sent over in order than it can instruct the server accordingly?
Posted
by Piepants.
Last updated
.
Post not yet marked as solved
1 Replies
301 Views
Hello, I am approaching the recent PTT Framework as my desire is to create a Walkie Talkie app. I watched the video and followed the documentation. I haven't managed to get it working yet, as there are some steps that aren't 100% clear to me. But the biggest doubt right now is: if I manage to create a walkie talkie App that works with PTT Framework on SwiftUI, will I be able to integrate this functionality in some way with the Android version of the same App? I don't know if it's worth mentioning but my backend right now is Firebase.
Posted
by enrico-g.
Last updated
.
Post not yet marked as solved
0 Replies
194 Views
The push is received normally, but the metrics are displayed as 0, making it impossible to check any indicators. Someone knows any solution? The metrics implemented in Braze using the same method are displayed normally, but the implementation through FCM is only shown as 0.
Posted
by iljun.
Last updated
.
Post not yet marked as solved
1 Replies
408 Views
I have a question about APNs specifications. We are aware that if we delete the app, we will disable the device token managed by APNs. we intend to send a push notification from AWS SNS to APNs and if the device token is disabled, AWS SNS will identify that the app has been deleted from our phone. I believe the specification is that iOS uninstall data is only available after the 8th day. However, it has been a month since the uninstallation and still the APNs are not returning the device token as invalid. Why is the uninstall data not available? If there is a way to do this waiting up, please let me know.
Posted
by Yahiro96.
Last updated
.
Post not yet marked as solved
0 Replies
363 Views
I'm tring to Send Notification using cURL Command for that i used curl commad curl -v \ --cert "${CERTIFICATE_FILE_NAME}" \ --cert-type DER \ --key "${CERTIFICATE_KEY_FILE_NAME}" \ --key-type PEM \ --header "apns-topic: xobuya" \ --header "apns-push-type: alert" \ --header "apns-priority: 5" \ --header "apns-expiration: 0" \ --data '{"aps":{"alert":{"title":"title","subtitle":"subtitle","body":"body"}}}' \ --http2 https://api.push.apple.com:443/3/device/my-id I have a also run this in order to get .pem openssl x509 -inform DER -in aps.cer -out aps.pem but i got error like this ` * Connected to api.push.apple.com (17.188.180.206) port 443 schannel: disabled automatic use of client certificate schannel: certificate format compatibility error for aps.cer 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 Closing connection curl: (58) schannel: certificate format compatibility error for aps.cer`
Posted
by xobuya.
Last updated
.
Post not yet marked as solved
0 Replies
216 Views
We have observed that the following command causes NotNow: InstallProfileCommand(https://developer.apple.com/documentation/devicemanagement/installprofilecommand) InstallProvisioningProfileCommand(https://developer.apple.com/documentation/devicemanagement/installprovisioningprofilecommand) SecurityInfoCommand(https://developer.apple.com/documentation/devicemanagement/securityinfocommand) CertificateListCommand(https://developer.apple.com/documentation/devicemanagement/certificatelistcommand) InstallApplicationCommand(https://developer.apple.com/documentation/devicemanagement/installapplicationcommand) ManagedMediaListCommand(https://developer.apple.com/documentation/devicemanagement/managedmedialistcommand) 1,2,3 becomes NotNow while the iOS device is locked. I don't know under what circumstances 4, 5, 6 become NotNow. Please tell me.
Posted Last updated
.
Post not yet marked as solved
0 Replies
253 Views
Hello, I am developing a service using Voip Push. Recently, it seems that Voip Push notifications are occasionally arriving late. Does anyone have information regarding this issue? Sometimes, when the delay is prolonged, notifications from a few days ago also seem to be received. Thank you.
Posted Last updated
.
Post not yet marked as solved
0 Replies
359 Views
I have been having a problem in our application while handling the VoIP notifications. sometimes the didReceiveIncomingPushWith delegate function is invoked when a VoIP Notif is sent but when the call is accepted nothing happened from the caller's side, like the callback to the caller to notify him that the call is accepted doesn't happe. And sometimes the didReceiveIncomingPushWith is not even invoked when a VoIP notif is sent. here is a potion of the code. func pushRegistry(_ registry: PKPushRegistry, didReceiveIncomingPushWith payload: PKPushPayload, for type: PKPushType, completion: @escaping () -> Void) { NSLog("pushRegistry didReceiveIncomingPushWith() type:(type)") // Handle the push payload if let pushHashtable = payload.dictionaryPayload["aps"] as? [AnyHashable: Any] { if let pushMessage = pushHashtable["alert"] as? String { NSLog("push message=\(pushMessage)") } } if type == PKPushType.voIP { // Process the received push: if it is a VoIP push, this must be an incoming call because we deactivated push for REGISTER refresh from Kamailio server if SipService.instance?.currentCall != nil { // A call is already going on, ignore this VoIP push NSLog("pushRegistry - voip push, and we already have a currentCall: we already received the INVITE, or it is a voip push for another call -> let's ignore it") completion() return } // We want to send a REGISTER anyway to get the pending INVITE message. // Then, the incoming call will be notified in the SIP stack onCallNew(_ call: Call!) callback // Since iOS 13, it is mandatory to report an incoming call immediately after a Voip push // instead of waiting for the SIP INVITE (in EngineDelegate.onCallNew()) // See details here: https://forums.developer.apple.com/message/376630#376630 NSLog("pushRegistry - >= iOS 13 -> showing callkit before SIP INVITE") if let callerSipUri = payload.dictionaryPayload["caller-sip-uri"] as? String { NSLog("push caller-sip-uri=\(String(describing: callerSipUri))") SipUtils.findCallerName(fromSip: callerSipUri) { callerName in let customCallerName = (callerName ?? "Inconnu") + (CallKitService.instance?.CALLKIT_DEBUG_MODE == true ? " [PUSH]" : "") DispatchQueue.main.async { CallKitService.instance?.reportNewIncomingCallToCallKit(callerName: customCallerName) { completion() } } } } else { // That should not happen: Kamailio server is supposed to add the caller SIP URI in the VoIP push DispatchQueue.main.async { CallKitService.instance?.reportNewIncomingCallToCallKit(callerName: nil) { completion() } } } // No call is going on, so we want to take this call, so we want to send a REGISTER if needed SipNetworkMonitoring.instance.start() } else { NSLog("pushRegistry - not a VoIP push") completion() } } here is the reportNewIncomingCallToCallKit function implementation func reportNewIncomingCallToCallKit(callerName: String?, completion: @escaping () -> Void) { NSLog("Callkit - reportNewIncomingCallToCallKit from %@", callerName ?? "Inconnu") let update = CXCallUpdate() update.remoteHandle = CXHandle(type: .generic, value: callerName ?? "Inconnu") update.hasVideo = true // we may already have reported a new call to CallKit // (since iOS13, we must do it in the didReceiveIncomingPushWith() callback) // In this case, the CallKit UI is already showing with caller="Inconnu": we will update it with the caller name. if let currentUuid = currentUuid { NSLog("Callkit - already a CallKit call showing -> updating the existing call ...") self.cxProvider?.reportCall(with: currentUuid, updated: update) } else { NSLog("Callkit - now CallKit call showing -> new call ...") let newUuid = UUID() self.currentUuid = newUuid self.cxProvider?.reportNewIncomingCall(with: newUuid, update: update) { error in completion() } } // dont configure audioSession here, wait for the Callkit "didActivate audioSession" callback } just to clarify : findCallerName is a function to get the called name from a list from the Backend with an escaping closure, (I tried to overpass that function and just give a default name to the caller but still same problem) . ANY HELP PLEASE?
Posted Last updated
.
Post not yet marked as solved
1 Replies
392 Views
For a period of time, we have frequently received reports of users receiving duplicate message notifications. We can ensure that the message is only sent once and there is only one ApnsId, but when it reaches the device, there are multiple duplicate notifications (2-3) I suspect this may be related to iOS 17, as there seems to be some overlap in time. Have others encountered similar problems? We sincerely hope to receive help from society. Thank you for your help~
Posted
by pity.
Last updated
.
Post not yet marked as solved
0 Replies
251 Views
I am checking the Push Notification Console of Cloudkit to understand my apps push delivery metrics. There are nice metrics in there to see push sends and discards. But I couldn't see any metric to understand "How many of the users opened the notiifications I send". Is there any way me to understand this statistic? Also can we export this metrics without logging in to CloudKit like an API request?
Posted
by emindeniz.
Last updated
.
Post not yet marked as solved
1 Replies
271 Views
I have multiple mobile applications, one developed in React Native and the other in Objective-C and Swift hybrid technology. I use my own system to send push notifications, and these notifications are left encrypted in the Apple queues. However, in any of my applications, I am unable to catch these messages in the code block where I decrypt them. As a result, users see the messages encrypted. While I can deterministically detect this issue on devices experiencing the offload feature from Apple, I've also noticed sporadic occurrences of this issue on devices not utilizing offload. Due to my security policies, I have no chance of sending messages unencrypted. I'm trying to understand why this is happening and need suggestions for a solution. Is there anyone who can help? Additional Information: I use my own system for push notifications. Messages are left encrypted in the Apple queues. I am unable to catch the messages in the code block where I decrypt them in one of the applications. I can deterministically detect the issue on devices experiencing the offload feature. I've noticed sporadic occurrences of this issue on devices not using offload. Due to security policies, I have no chance of sending messages unencrypted. I tried sending without offloading, and the messages arrived unencrypted I searched for a callback handler function on the Apple side - couldn't find one. To ensure notifications were sent correctly, I performed token checks in my database.
Posted Last updated
.
Post not yet marked as solved
1 Replies
232 Views
Hi! I have recently added the functionality of notifications in my app. I can send notifications and I see them in my phone well. The problem is that even if I have no notifications, the badge shows I have 3 and I can not remove this notification when I read the notifications. What it is strange is that even if I send new notifications, the number 3 is still there...
Posted Last updated
.
Post not yet marked as solved
0 Replies
241 Views
I have a shopping list app that shares a list of Product records between users. The app on my phone shared its private database with another user account (running on a simulator) which accepted it. Both devices can see changes from the other if the device does a full refresh from iCloud. Now I want to have the app on the devices be notified when the other changes/adds/deletes a Product record. I did the following to get push notifications to work (but haven't been successful yet) I have enabled background fetch and remote notifications in my app capabilities. The app registers for remote notifications with UIApplication.shared.registerForRemoteNotifications() and receives the didRegisterForRemoteNotificationsWithDeviceToken callback. The app sets a subscription with CKModifySubscriptionsOperation for the "Product" recordType. I set the QoS to .utility on the appropriate private or shared database. However, when I add a Product record on my record, the didReceiveRemoteNotification callback doesn't execute. What am I missing?
Posted
by bobku.
Last updated
.
Post marked as solved
1 Replies
306 Views
Hi, I need a feature in the iOS app that requires updating the user screen via FCM. In other words, I have to update it with no sound and screen display, but this doesn't work. When I remove the notification field, the notification will not be displayed to the user, but the sound will be played. If I remove the sound field, I can make no sound, but the user will be notified. If I remove both, I'm not getting this from the iOS app. How can I solve this?? Which option should I send Push from the server?? I'm also using Notification Service Extension.
Posted
by kimjitae.
Last updated
.