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

PushKit Documentation

Posts under PushKit tag

43 Posts
Sort by:
Post not yet marked as solved
0 Replies
408 Views
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.
Posted
by
Post not yet marked as solved
0 Replies
331 Views
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?
Post not yet marked as solved
1 Replies
482 Views
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
Posted
by
Post not yet marked as solved
0 Replies
533 Views
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.
Posted
by
Post not yet marked as solved
1 Replies
1.1k Views
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); } }
Posted
by
Post marked as solved
1 Replies
753 Views
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.
Posted
by
Post not yet marked as solved
0 Replies
600 Views
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.
Posted
by
Post not yet marked as solved
1 Replies
573 Views
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?
Posted
by
Post not yet marked as solved
0 Replies
472 Views
The name of my app is mixed in uppercase and lowercase, but when I tested the push, all the app names in the notification I received were changed to uppercase letters. For example, the APP name is AppTest, and the APP name displayed in the notification is APPTEST. Why is this
Posted
by
Post not yet marked as solved
0 Replies
652 Views
Code file I am working in VOIP application. I can receive voip push when app in background or foreground. But when an app is killed and device locked voip delegate "didReceiveIncomingPushWithPayload" method not called. Also, I am facing below crash Killing VoIP app because it failed to post an incoming call in time VoIP push for app dropped on the floor
Posted
by
Post not yet marked as solved
0 Replies
443 Views
lately, we found out that all notifications from the app I developed suddenly vanished for no reason when a new notification arrived. Mostly this case happened on iOS 16, and the notification has threadID by which we want to fulfill the notification grouping. When I continuously sent 4-5 notifications to my iPhone this case will happen. Problem screen recording did anyone encounter this situation? Why and how to fix it
Posted
by
Post not yet marked as solved
1 Replies
454 Views
I have an App that is part of a VoIP PBX system but which is NOT a VoIP App. It acts like a remote control that allow you to forward calls to our VoIP PBX to your cellular phone, or even setup calls to internal extensions all by using the Cellular network. One of the features we want to implement is to indicate to other users on our VoIP PBX system that someone using our App is in an active call using the cellular network. We managed to make that work, but only whilst the App is in the foreground. We are now struggling to find proper ways to activate a little bit of code in our App that will relay the Phone App state (RINGING, OFFHOOK, INCALL, etc...) to our VoIP PBX system. We are not a VoIP application and as such cannot utilise CallKit, and from what I understand, we cannot use PushKit anymore without using CallKit because people were abusing it to keep running their App in the background and thus reducing battery life. (Which I fully comprehend). But our app does not need to be active in the background and isn't a VoIP App, we only need it to wake up when the Phone App state changes and then do it's small networking task. So, can this actually be done properly? PS: To ensure the privacy of the user, the user needs to enable this feature him/herself. It is not enabled by default and can be switched off by the user as well.
Posted
by
Post not yet marked as solved
1 Replies
967 Views
We're currently trying to develop an Apple Watch companion app for our iOS app using the new WatchOS 9 which has the VoIP call capabilities. Is there a way to mirror VoIP notifications similarly to push notifications between the WatchOS app and iOS app? Essentially we'd like to be able to send a VoIP notification to the iOS app and have the answer/decline call screen show up in both the iPhone and Apple Watch. Currently when we send a VoIP notification to the iOS app, the Apple Watch does not receive anything. Push notifications and local notifications work just fine.
Posted
by
Post not yet marked as solved
2 Replies
1.5k Views
According to SpeakerBox sample code, the Watch App should register for receiving the PushKit notifications like so: let pushRegistry = PKPushRegistry(queue: DispatchQueue.main) pushRegistry.delegate = self pushRegistry.desiredPushTypes = [.voIP] This would then cause a delegate method to be called with a token: func pushRegistry(_ registry: PKPushRegistry, didUpdate pushCredentials: PKPushCredentials, for type: PKPushType) { } That, however, never happens. I've already have the required entitlement and this exact same logic works fine on the main iOS app, however, in the companion watchOS app, it does nothing. What am I missing here? Also, since this is not a standalone watchOS app, it doesn't really make sense that it would have its own pushKit token. Isn't there a way to notify the watch about an incoming call using the same pushKit token received on the phone? Thanks in advance,
Posted
by
Post not yet marked as solved
3 Replies
1.5k Views
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?
Posted
by
Post not yet marked as solved
2 Replies
1.6k Views
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 }
Posted
by
Post not yet marked as solved
4 Replies
2.0k Views
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 :-(
Posted
by