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

Posts under PushKit tag

42 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

Impact on existing iOS App by updating to the enhanced HTTP/2 based API from server side
I have an existing iOS application available on AppStore which has push notification implemetented. Currently we are using the legacy binary protocol in Server side while sending request to the Apple Push Notification service (APNs) which will no longer support post of November 2020.We are making changes to update this with enhanced HTTP/2 based API in server side to communicate with APNS, will this impact my existing iOS application? Do I need to make any changes / code changes from client (iOS App) side to make it compatible with my existing application?
1
0
1.2k
Oct ’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.2k
Jul ’23
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.8k
Sep ’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.2k
Jan ’24
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.7k
Sep ’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.2k
Jan ’24
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
596
Aug ’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
571
Oct ’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
371
Oct ’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
485
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
367
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
448
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
RBSTerminateContext| domain:10 code:0xBAADCA1 no explanation given
Date/Time: 2023-12-22 10:15:42.0985 +0800 Launch Time: 2023-12-22 10:12:52.8757 +0800 OS Version: iPhone OS 17.1.2 (21B101) Release Type: User Baseband Version: 4.06.02 Report Version: 104 Exception Type: EXC_CRASH (SIGKILL) Exception Codes: 0x0000000000000000, 0x0000000000000000 Termination Reason: FRONTBOARD 3131951633 &amp;lt;RBSTerminateContext| domain:10 code:0xBAADCA11 explanation: reportType:CrashLog maxTerminationResistance:Interactive&amp;gt; Triggered by Thread: 0 Thread 0 name: Dispatch queue: com.apple.main-thread Thread 0 Crashed: 0 libsystem_kernel.dylib 0x1e6bfc1d8 mach_msg2_trap + 8 1 libsystem_kernel.dylib 0x1e6bfbf70 mach_msg2_internal + 79 2 libsystem_kernel.dylib 0x1e6bfbe88 mach_msg_overwrite + 435 3 libsystem_kernel.dylib 0x1e6bfbcc8 mach_msg + 23 4 CoreFoundation 0x19f725d0c __CFRunLoopServiceMachPort + 159 5 CoreFoundation 0x19f723c04 __CFRunLoopRun + 1207 6 CoreFoundation 0x19f723668 CFRunLoopRunSpecific + 607 7 GraphicsServices 0x1e2aee5ec GSEventRunModal + 163 8 UIKitCore 0x1a1b402b4 -[UIApplication _run] + 887 9 UIKitCore 0x1a1b3f8f0 UIApplicationMain + 339 10 iCSee 0x103921380 main + 115 (main.m:17) 11 dyld 0x1c2176dcc start + 2239
1
0
702
Jan ’24
PushKit: XPC PushKit connection invalidated from client
Hi, Some of my iOS test devices do not receive PushKit notification anymore. I request and receive a VoIP token at app startup, then register it. I report any incoming PushKit notification directly to CallKit on the same thread. But some devices do not receive the PushKit/VoIP notification (app in foregroud or in background). They used to. Some other devices are receiving it with the same code, for a successful call. I tried reinstall and device restart with no success. I can see on the problematic devices at app startup in the console: callservicesd XPC PushKit connection invalidated from client <private> before seing: callservicesd Registering client process <private> with bundle identifier <private> for PushKit voip in environment <private> I could not find anything on "PushKit connection invalidated from client", anyone knows what triggers it? Thanks.
0
0
545
Jan ’24
CallKit VOIP end reason
When there is an ongoing call, if the user gets another one, we don't want to support multi-call and directly send the new call to the voicemail. For this operation what should be CXCallEndedReason? My understanding is that remoteEnded is used when the call connected and then ended. unanswered might be the choice for me but would it cause any issue if i directly reject a call with this status (the difference between the incoming call and reject time would be too short)? There is also declinedElsewhere , which might be suitable
0
0
457
Jan ’24