Respond to push notifications related to your app’s complications, file providers, and VoIP services using PushKit.

Posts under PushKit tag

41 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

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.3k
Dec ’23
localizedCallerName is not updated in iOS 17.2
CallKit is not get updated on iPhone 14 with Dynamic Island When I am receiving incoming call I need to update localizedCallerName in CallKit. As of iOS 17.2, localizedCallerName does not change. Is there anything I need to specify to update the name? Looks like the problem is related to CXCallUpdate() This is the code I use for updating caller name: func updateCallerName(_ call: Call) { let update = CXCallUpdate() update.localizedCallerName = call.localizedCallerName cxProvider.reportCall(with: call.uuid, updated: update) }
0
1
411
Dec ’23
Solving 0xbaadca11 crashes in few failure cases
The crash 0xbaadca11 seems to happen with PushKit and CallKit usage. I/we understand that as and when we receive voip push message from PushKit, we have to report the call to CallKit. However in some situations and data from payload (Like call with UUID already exists / payload decryption fails) where we are not supposed to report the call to user. The app gets crashed and further get blacklisted to get calls. Is there any way for developers to directly and silently report call failure to PushKit / CallKit.
0
0
332
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
441
Dec ’23
Is there an public API to listen the event of push notification arrival for all apps on the MacOS?
From an MacOS Application, I want to listen for the arrival of push notification event for any app installed on the Mac system. I understand, AppKIt provides API to listen for receiving push notification of that application. But, Is there any API, which can listen and just notify the developing app when a notification arrived for any apps installed on the system?
0
0
347
Oct ’23
Not Receiving VOIP Push Token In Time
I have created VOIP IOS app in Xamarin, I have registered pushkit in the AppDelegate's didFinishLaunchingWithOptions and have implmented PKPushRegistryDelegate's didReceiveIncomingPushWithPayload:forType:withCompletionHandler and immediately report to call kit and invoke the completion handler. However whenever I receive a VOIP push after device boot I get these console logs: default 15:24:32.153522-0400 callservicesd Invalidating process assertion for bundle ID <private> from timeout error 15:24:32.154786-0400 callservicesd Killing VoIP app <private> because it failed to post an incoming call in time. It kills my app BEFORE I have a chance to report it to call kit since it DOESN'T enter the didReceiveIncomingPushWithPayload:forType:withCompletionHandler. However if I wait 2+ minutes after device boot to send a VOIP APN Push I will receive the VOIP push, it will enter didReceiveIncomingPushWithPayload:forType:withCompletionHandler and report it to call kit just fine. I don't understand why this is the case and how to fix it. I have been told to make the app just like What's App so my app must be able to receive incoming voip push at any point the device is on. Is this an issue with the device? I have been testing on a iPhone 7 Plus on version 15.7.1. Is this a internet connection issue? Could it be something else? Is there an explanation for this behavior and is there any solutions? Thank you very much
1
0
525
Oct ’23
What could be causing the inconsistent behavior in notification processing when the Flutter app is in a killed state?
I'm developing a Flutter application that utilizes topic messaging to send notifications to iOS devices using Firebase Cloud Messaging (FCM). I've followed the FCM documentation to initialize the topic and set up an API for sending messages. The API is triggered every hour through a cron job on the server. When a topic message is received, the app displays a notification and performs some background processing. While the notification is successfully delivered when the app is in the background, I'm encountering inconsistent behavior when the app is in a killed state. What I've Tried: I've double-checked the implementation of the FCM topic initialization and the message sending API, and everything appears to be correct. I've also verified that the cron job on the server is running as intended and the API calls are being made regularly. The issue seems to be related to how the app behaves when it's not running in the background. Topic Initialisation: if (!Platform.isAndroid) { await FirebaseMessaging.instance.subscribeToTopic("ios-scheduling"); } API for delivering topic message: router.post('/', (req, res) => { const topic = "ios-scheduling"; const body = req.body; console.log("Request Body", req.body); const message = { notification: { title: "OsuniO", body: "You may have some pending tasks.", }, data: { "notificationType": body['notificationType'] }, apns: { payload: { aps: { contentAvailable: true, "interruption-level": "time-sensitive" } }, headers: { "apns-push-type": "background", "apns-priority": "5", "apns-topic": "io.flutter.plugins.firebase.messaging" } }, topic: topic }; console.log("message to be sent to the user: ", message); admin.messaging().send(message) .then((response) => { // Response is a message ID string. console.log('Successfully sent message:', response); res.status(200).json(message); }) .catch((error) => { console.log('Error sending message:', error); res.status(400).json({ message: error }).end(); }); }); module.exports = router; Expected Behavior: I expect that when a topic message is sent via FCM, regardless of whether the Flutter application is in the foreground, background, or killed state, the notification should be reliably displayed on the device. Additionally, the associated API should be triggered consistently to perform the required background processing.
0
0
558
Aug ’23
Push Notification to Apple Wallet Passes failing with WinHttpException exception
I am trying to write some code to send a push notification to a pass on an Apple device using C# .NET and HttpClient over HTTP2 with client certificate authentication. When I run the code, I am seeing the below exception: InnerException = {"Error 12152 calling WinHttpWriteData, 'The server returned an invalid or unrecognized response'."} I am trying to find out why this code is failing? Is it possible to debug/troubleshoot this in some way? Running this code on Windows 10 OS Build version: 21H2 (19044). The application is built on .Net Framework 4.8 and tried using WinHttpHanlder versions 6 and also 7. Also, tried using other third party open source libraries like PushSharp and DotApns. PushSharp does not seem to support Http/2 and dotApns does not support certificate authentication for .net framework. We have no plans to migrate to .net Core. Below is my code: private static string pushToken = "dbc56849<hidden>"; private static string AppleApnServer = "https://api.sandbox.push.apple.com"; public static async Task<PushResult> SendPushNotificationToWalletPass(string notificationContent) { byte[] certificateData = LoadCertificate(); X509Certificate2 certificate = new X509Certificate2(certificateData, String.Empty, X509KeyStorageFlags.MachineKeySet | X509KeyStorageFlags.PersistKeySet | X509KeyStorageFlags.Exportable); string url = $"{AppleApnServer}:443/3/device/{pushToken}"; StringBuilder payload = new StringBuilder(); payload.Append("{ \"aps\" : "); if (string.IsNullOrWhiteSpace(notificationContent)) { payload.Append("\"\" }"); } else { payload.Append(notificationContent); payload.Append(" }"); // close aps dictionary } var handler = new Http2Handler(); handler.ClientCertificates.Add(certificate); using (var httpClient = new HttpClient(handler)) { using (var request = new HttpRequestMessage(HttpMethod.Post, url)) { var messageGuid = Guid.NewGuid().ToString(); request.Content = new StringContent(payload.ToString()); request.Headers.Add("apns-id", messageGuid); request.Headers.Add("apns-push-type", "alert"); using (var response = await httpClient.SendAsync(request, HttpCompletionOption.ResponseHeadersRead)) { HttpStatusCode statusCode = response.StatusCode; string reasonPhrase = response.ReasonPhrase; bool success = response.IsSuccessStatusCode; Console.WriteLine($"APN {(success ? "Delivered Successfully!" : $"Failed to Send! :: StatusCode [{statusCode}] Reason [{reasonPhrase}]")} :: PushToken [{pushToken}]"); if (!success) { switch (statusCode) { case HttpStatusCode.Gone: // The device token is no longer active for the topic. return PushResult.DeviceNotRegistered; default: return PushResult.Failure; } } return PushResult.Success; } } } } public enum PushResult { Success = 0, Failure = 100, DeviceNotRegistered = 200 } // Apple APNS requires http2 but .Net Framework does not support http2 (only built in support in .net core) // found this workaround https://stackoverflow.com/questions/32685151/how-to-make-the-net-httpclient-use-http-2-0/43101990#43101990 private class Http2Handler : WinHttpHandler { protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) { request.Version = new Version("2.0"); return base.SendAsync(request, cancellationToken); } }
1
0
1.1k
Jan ’24
CloudKit Console: JSON Web Token Validator shows Unrecognizable claims found (Token Generated with Python)
Hello guys I am getting this error Unrecognizable claims found when trying to validate my JWT Token for push notifications. I don't understand what it means. Can someone tell me how to resolve this issue? I am using python, and using the time module to generate the epoch. I guess, this is where the issue is coming from, but I am not sure. import time epoch = time.time() Thanks in advance.
1
1
788
Jul ’23
APNS notifications are not received in device, but server gets success (200) when send to APNS
In my application, I'm using both APNS for push notifications. In my app, both tokens are generated properly and updated on my App's server. When sending an APNS push from my server, the push is successfully reached the APNS server, but can't deliver to the device, even though we are getting success from APNS Server. we are getting 200 from APNS. but the same thing If I am trying to use the "Push Hero" 3rd Party app, and I am getting notifications in the app also, with no any issue. but can't get it from my server. I am using a .p8 file for push notifications in both the server and 3rd party apps.
0
0
625
Jul ’23
iOS CallKit, PushKit: Strange behaviour. Sometimes answering UI doesn't pop up
I made an app for calls with CallKit and PushKit. It seems everything is done correctly, according to apples manual on CallKit and PushKit. If I start app on two devices, and try to make a call everything is working for the first time, and it can work for the second time and so on. But then, by unknown reason (I don't handle any errors), the phone that receives voip push notification ringing but doesn't show the panel with answer/decline buttons. If that happens, new incoming calls work the same broken way. To improve that broken situation I must initiate outgoing call with CallKit on broken phone. I don't post any code, it just the same as in numerous examples. Do anyone has guess what's wrong?
1
0
596
Jul ’23
PushKit sometime not returning VoIP token
We are implementing PushKit/CallKit for audio video calls. When the app starts, it immediately in AppDelegate-didFinishLaunchingWithOptions create the PKPushRegistry, set the delegate and ask for the token with desiredPushTypes and upload the token to our backend when PKPushCredentials are received. Then when didReceiveIncomingPushWith is called, it directly reports the call to CallKit. That works fine on all devices, with the app in foreground, background, killed etc.. But on one slow device (iPhone 7, iOS 15.6.1) when the app has been killed for some time, the app do not receive anymore the token. Then at some point PushKit doesn't wake the app anymore, as CallKit was not notified. According to the console logs by filtering callservicesd, the time between receiving the PushKit notification being received and delivering the token changes a lot, and then can timeout: Successful call: default 15:00:58.181051+0200 callservicesd Received incoming APS message from application with bundle identifier <private> and topic <private> // ... default 15:01:00.627903+0200 callservicesd Delivering token <private> to application <private> So 2 seconds. Failing call: default 14:13:20.325371+0200 callservicesd Received incoming APS message from application with bundle identifier <private> and topic <private> // ... default 14:13:28.827702+0200 callservicesd Delivering token <private> to application <private> // ... default 14:13:32.325062+0200 callservicesd Invalidating process assertion for bundle ID <private> from timeout 8 seconds. Even if "callservicesd Delivering token" is written in the logs, the app do not receive it. Then for the failing call, as didUpdate pushCredentials and didReceiveIncomingPushWith are not called, the app get killed: default 14:13:32.326334+0200 runningboardd Invalidating assertion 33-134-19180 (target:[application<myAppId>:1363]) from originator [daemon<com.apple.telephonyutilities.callservicesd>:134] default 14:13:32.393456+0200 runningboardd Received termination request from [daemon<com.apple.telephonyutilities.callservicesd>:134] on <RBSProcessPredicate <RBSProcessIdentityPredicate| application<myAppId>>> with context <RBSTerminateContext| domain:10 code:0xBAADCA11 explanation:<no explanation given> reportType:CrashLog maxTerminationResistance:Interactive> error 14:13:32.404027+0200 callservicesd Killing VoIP app <private> because it failed to post an incoming call in time. Is there any way to make sure that the token and the VoIP push will be delivered in time and not be killed by iOS, even on slow device?
3
3
1.6k
Sep ’23
How to only make a notification sound without notification banner
When I call the completion handler from the following User Notification Center delegate function and pass UNNotificationPresentationOptions.sound I still get the notification banner: override func userNotificationCenter( _ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void ) { completionHandler(.sound) } All I want is a way to just make a notification sound without showing the notification while the app is in the foreground. Any ideas? This is how I am requesting authorization: [[UNUserNotificationCenter currentNotificationCenter] requestAuthorizationWithOptions: (UNAuthorizationOptionBadge | UNAuthorizationOptionSound) completionHandler: ^ (BOOL granted, NSError * _Nullable error) { }]; This is the notification request: var notification = UNMutableNotificationContent() if (notification != nil) { notification.categoryIdentifier = "id" notification.sound = .default notification.title = "title" notification.body = "body" request = UNNotificationRequest( identifier: NSUUID().uuidString, content: notification, trigger: nil ) UNUserNotificationCenter.current().add(request) { (error) in }
2
0
1.6k
Jun ’23
iOS VoIP App running on M1 Mac Callkit and Pushkit not working
I took delivery of my first M1 Mac (iMac running Big Sur 11.4) and with great anticipation installed my iOS VoIP App from the AppStore. I was greatly disappointed to see that There were no VoIP Pushes to start an incoming call Callkit does not seem to work so I get no Audio. Am I missing something? Is there some permissions or configuration I might need to set? Or is it just that Callkit and Pushkit don't work even though it states on developer.apple.com that they are supported on macOS 10.15+ Any advice or guidance greatly appreciated. Very disappointed :-(
6
1
2.1k
Jan ’24
Using UNNotificationServiceExtension with FCM not getting called
I don't know what could be wrong but my UNNotificationServiceExtension is never getting called by any push from FCM. I call the FCM from a Python3 script and so far it works (I get a push notification but always with the default text and not the modified one). firebaseHeaders = { "Content-Type":"application/json", "Authorization":"key=MYKEY" } firebaseBody = { "to":devicetoken, "priority":"high", "mutable-content":True, "apns-priority":5, "notification": { "titlelockey":"push.goalReachedTitle", "bodylockey":"push.goalReachedContentRemote", "bodylocargs":[str(entry['value']), entry['region']], "sound":"default", "badge":1 }, "data": { "values":data, "region":entry['region'], "value":entry['value'] } } firebaseResult = requests.post("https://fcm.googleapis.com/fcm/send", data=None, json=firebaseBody, headers=firebaseHeaders) My Extension is also pretty basic (for testing) and I already tried to remove it and add it again to my main app project without success. class NotificationService: UNNotificationServiceExtension { var contentHandler: ((UNNotificationContent) -> Void)? var bestAttemptContent: UNMutableNotificationContent? override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) { self.contentHandler = contentHandler bestAttemptContent = (request.content.mutableCopy() as? UNMutableNotificationContent) if let bestAttemptContent = bestAttemptContent { bestAttemptContent.title = bestAttemptContent.title + " [TEST 123]" contentHandler(bestAttemptContent) } } override func serviceExtensionTimeWillExpire() { // Called just before the extension will be terminated by the system. // Use this as an opportunity to deliver your "best attempt" at modified content, otherwise the original push payload will be used. if let contentHandler = contentHandler, let bestAttemptContent = bestAttemptContent { contentHandler(bestAttemptContent) } } } Anyone has a idea what I still can check, test or miss?
7
2
6.6k
Sep ’23
VoIP push notification without VoIP funcionality
Hello, we're currently working on an app for emergency organisations. In case of an emergency it's crucial to alert all users just in time. We've tested remote notifications. They're not really reliable for a time critical use case. Our idea is to use VoIP push notifications to alert the users. Before we start testing it, I would like to know if we'll run into an issue with the App Store approval if we just use VoIP PN without having VoIP functionality in our app. Regards, Enno
3
0
2.1k
Jul ’23