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

PushKit Documentation

Posts under PushKit tag

45 Posts
Sort by:
Post not yet marked as solved
0 Replies
130 Views
I think I've got all the keys and entitlements set up ok. I have no problem receiving normal alerts via the UNUserNotifications framework. Now I'm trying to use PushKit (for fileProvider). I have the following in my AppDelegate fileProvider = PKPushRegistry(queue: nil) fileProvider.delegate = self fileProvider.desiredPushTypes = [.fileProvider] along with the required delegate functions. I am never provided with credentials, only an immediate call to the didInvalidatePushToken delegate. Any suggestions appreciated.
Posted Last updated
.
Post not yet marked as solved
0 Replies
261 Views
Is there a way for the app currently playing music or voice in the background to know when a Critical Alert or push comes? Currently, my app contains code that stops playback when a call comes in while music or voice is playing in the background. So, if a call comes in during playback, it stops normally. However, there is a phenomenon in which playback cannot be stopped when a Critical Alert or push comes. When a Critical Alert or push comes to the device, is there a way in the code for the app currently playing music or voice in the background or foreground to know at that moment? We are not sending out Critical Alerts or pushes. I would like to know how to resolve the situation when receiving a Critical Alert or push sent to all users in one country.
Posted Last updated
.
Post not yet marked as solved
0 Replies
222 Views
I am facing a strange problem with PushKit/CallKit when compiling with SDK 17.x. The app behaves normally on iOS 16 and iOS 17 devices but PushKit does not seem to work properly anymore with VoIP Push messages. The behavior is as follows: when the screen is unlocked, everything works as expected (app gets automatically started when not running and the call notification is displayed) when the screen is locked and the app is already running, everything works as expected (CallKit call screen is shown) when the app is not running and the screen is locked, nothing happens... but as soon as I unlock the screen the app gets started and CallKit can be informed about the call. After this the call notification is properly displayed. In the logs of the app I can see that the app didn't get started/informed about the VoIP Push notification before unlocking the screen Now the second problem is: as iOS doesn't start the app properly when the screen is locked, the app can't display the call via CallKit. Because of that the app will get blacklisted after a while (and for a while). Before using iOS SDK 17 the app was working without any issues on iOS 15 devices. Is this a known issue?
Posted
by nappsoft.
Last updated
.
Post not yet marked as solved
0 Replies
207 Views
Hi, I have implemented VOIP calling feature in my application using OpenTok SDK and CallKit framework. Calling feature is working most of the time. But there is one strange issue I have come across. During a call, if any external cellular call appears and if I decline that external call then my running voip call also disconnects. This is happening some of the iPhone devices. iPhone config: Model: iPhone 11 iOS Version: 17.3 I have added loggers CXEndCallAction and -provider:performEndCallAction and debugged at my end. I found that CXEndCallAction is not executing from my end but still -provider:performEndCallAction is triggered by iOS along with my ongoing callUUID. This is very strange behaviour I am observing in one of my iPhone device. I have tested this in 4 iPhone devices but i am facing this issue only in 1 iPhone. Thanks,
Posted Last updated
.
Post not yet marked as solved
0 Replies
159 Views
Hi, I have implemented VOIP calling feature in my application using OpenTok SDK and CallKit framework. Calling feature is working most of the time. But there is one strange issue I have come across. During a call, if any external cellular call appears and if I decline that external call then my running voip call also disconnects. This is happening some of the iPhone devices. iPhone config is as follows Model : iPhone 11 iOS Version : 17.3 I have added loggers CXEndCallAction and -provider:performEndCallAction and debugged at my end . I found that CXEndCallAction is not executing from my end but still -provider:performEndCallAction is triggered by iOS along with my ongoing callUUID This is very strange behaviour I am observing in one of my iPhone device. I have tested this in around 3-4 iPhone devices but i am facing this issue only in 1 iPhone . Kindly help me here if anyone has solution around it . Thanks
Posted Last updated
.
Post not yet marked as solved
0 Replies
199 Views
Hello, I would like get advice about the time-sensitive notification ‘interruption-level’ set to ‘time-sensitive’ in the push payload. I’m wondering if this setting applies to VOIP push notifications. I tried to find information in Apple’s documentation, but it doesn’t specify whether it is applicable for VOIP push notifications. { "aps": { "interruption-level": "time-sensitive" } } https://developer.apple.com/documentation/usernotifications/generating-a-remote-notification#:~:text=ContentIdentifier%[…]terruption%2Dlevel,-String
Posted
by sundee.
Last updated
.
Post not yet marked as solved
0 Replies
263 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
287 Views
I'm trying to integrate Callkit into a Flutter app that uses webRTC for calls and I have an issue with taking calls on locked screen. CXAnswerCallAction requires to have the action.fulfill() method called after the connection is established. Here is a pice of code without waiting for establishment of the connection: guard let call = self.callManager?.callWithUUID(uuid: action.callUUID) else{ action.fail() return } call.data.isAccepted = true self.answerCall = call self.callManager?.updateCall(call) sendEvent(SwiftCallKeepPlugin.ACTION_CALL_ACCEPT, call.data.toJSON()) DispatchQueue.main.asyncAfter(deadline: .now() + .milliseconds(1200)) { self.configureAudioSession() } action.fulfill() } This causes the connection time counter to be immediately visible on the screen, but the user still has to wait for connection establishment and can't hear anything. Here is the code that waits for the establishment of the connection before calling action.fulfill(): if(self.awaitedConnection.uuid != uuid) { action.fail() } else if(self.awaitedConnection.isConnected) { DispatchQueue.main.asyncAfter(deadline: .now() + .milliseconds(1200)) { self.configureAudioSession() } action.fulfill() } else { DispatchQueue.main.asyncAfter(deadline: .now() + .milliseconds(1000)) { self.waitForConnection(uuid: uuid, action: action) } } } public func provider(_ provider: CXProvider, perform action: CXAnswerCallAction) { guard let call = self.callManager?.callWithUUID(uuid: action.callUUID) else{ action.fail() return } call.data.isAccepted = true self.answerCall = call self.callManager?.updateCall(call) self.awaitedConnection.uuid = action.callUUID self.awaitedConnection.isConnected = false sendEvent(wiftCallKeepPlugin.ACTION_CALL_ACCEPT, call.data.toJSON()) waitForConnection(uuid: action.callUUID, action: action) } Unfortunately, though it works great on iOS 15.7, on 17.3 it causes lack of audio, no sound and no recording. I also can't enable it later when the call is ongoing. For reference: let session = AVAudioSession.sharedInstance() do{ try session.setCategory(AVAudioSession.Category.playAndRecord, options: AVAudioSession.CategoryOptions.allowBluetooth) try session.setMode(self.getAudioSessionMode(data?.audioSessionMode ?? "voiceChat")) try session.setActive(data?.audioSessionActive ?? true) try session.setPreferredSampleRate(data?.audioSessionPreferredSampleRate ?? 44100.0) try session.setPreferredIOBufferDuration(data?.audioSessionPreferredIOBufferDuration ?? 0.005) }catch{ print(error) } } I can see in the docs of action.fulfill() that "You should only call this method from the implementation of a CXProviderDelegate method". I this the reason for the issue? But how can I do it if I need to wait for the connection asynchronously and the provider method is synchronous?
Posted
by cand123.
Last updated
.
Post not yet marked as solved
0 Replies
163 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
0 Replies
315 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
0 Replies
321 Views
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
Posted
by Btay.
Last updated
.
Post not yet marked as solved
3 Replies
1.9k 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 davemaj.
Last updated
.
Post not yet marked as solved
0 Replies
419 Views
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.
Posted
by md_td.
Last updated
.
Post not yet marked as solved
1 Replies
981 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 rakesh47.
Last updated
.
Post not yet marked as solved
1 Replies
501 Views
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
Posted
by JF001.
Last updated
.
Post not yet marked as solved
1 Replies
925 Views
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.
Posted
by sundee.
Last updated
.
Post not yet marked as solved
0 Replies
331 Views
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) }
Posted
by ULTARI.
Last updated
.