I’ve developed the Pro Talkie app—a walkie-talkie solution designed to keep you connected with family and friends
App Store: https://apps.apple.com/in/app/pro-talkie/id6742051063
Play Store: https://play.google.com/store/apps/details?id=com.protalkie.app
While the app works flawlessly on Android and in the foreground on iOS, I’m facing issues with establishing connections when the app is in the background or terminated on iOS.
Specifically, I’ve attempted the following:
Silent pushes and alert payloads: These are intended to wake the app in the background, but they often fail—notifications may not be received or can be delayed by 20–30 minutes, leading to a poor user experience.
VoIP pushes: These reliably wake the app, but they trigger the incoming call UI, which isn’t suitable for a walkie-talkie app that should connect directly without displaying a call screen.
I’ve enabled all the necessary background modes (audio, remote notifications, VoIP, background fetch, processing), but the challenge remains.
How can I ensure a consistent background connection on iOS without triggering the call UI?
PushKit
RSS for tagRespond to push notifications related to your app’s complications, file providers, and VoIP services using PushKit.
Posts under PushKit tag
59 Posts
Sort by:
Post
Replies
Boosts
Views
Activity
Hello,
We have a Push-to-Talk (PTT) application that is already well established and widely used. Our app has the proper VoIP entitlement, which we are using to wake up the app and establish a WebSocket connection for real-time communication. We are also using CallKit as a supporting mechanism, but not as the primary interaction upon receiving the VoIP Push, since our use case differs from traditional full-duplex VoIP calls.
While our implementation works correctly in many cases, we have noticed a consistent issue where, after multiple VoIP Push notifications, the system still delivers the push, but prevents the WebSocket from reconnecting.
At this point, all connection attempts return errors such as:
• "Software caused connection abort"
This issue persists until the app is manually relaunched, after which the behavior resets and repeats.
We are aware that VoIP Push was originally designed for full-duplex calls, but since Apple allows its use for other purposes through the entitlement, we would like to understand why this limitation is occurring and how to handle it properly.
Questions:
1. Is iOS enforcing stricter background execution rules after multiple VoIP Push events within a short period?
2. Are there any recommended best practices to ensure reliable WebSocket reconnection in this scenario?
Recently, I attempted to use LiveCommunicationKit to replace CallKit. The goal was to explore better features or integration.
However, a major problem emerged. When the app is in the background or killed, it shows no notifications. This seriously impairs the app's communication functionality as notifications are vital for users to notice incoming calls.
And it is working well when the app is in the foreground.
When the app is in the background, when the push message received. the app get crashed with the following information:
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Killing app because it never posted an incoming call to the system after receiving a PushKit VoIP push.'
Also, when I use CallKit instead of LiveCommunicationKit, the app works well in all cases.
The code is here:
LCK wrapper:
class LCKWrapper : NSObject, ConversationManagerDelegate {
var mgr: ConversationManager
var lckDelegate: LCKDelegate
var currentCallId: UUID
@objc init(handler: LCKDelegate, appName: String, appIcon: UIImage) {
self.lckDelegate = handler
var iconData: Data?
iconData = appIcon.pngData();
var cfg: ConversationManager.Configuration
cfg = ConversationManager.Configuration(ringtoneName: "ringtone.m4a",
iconTemplateImageData: iconData,
maximumConversationGroups: 1,
maximumConversationsPerConversationGroup: 1,
includesConversationInRecents: false,
supportsVideo: false,
supportedHandleTypes: Set([Handle.Kind.phoneNumber]))
self.mgr = ConversationManager(configuration: cfg)
self.currentCallId = UUID()
super.init()
self.mgr.delegate = self
}
func reportIncomingCall(_ payload: [AnyHashable : Any], callerName: String) async {
do {
print("Prepare to report new incoming conversation")
self.currentCallId = UUID()
var update = Conversation.Update()
let removeNumber = Handle(type: .generic, value: callerName, displayName: callerName)
update.activeRemoteMembers = Set([removeNumber])
update.localMember = Handle(type: .generic, value: "", displayName: callerName);
update.capabilities = [ .playingTones ];
try await self.mgr.reportNewIncomingConversation(uuid: self.currentCallId, update: update)
print("report new incoming conversation Done")
} catch {
print("unknown error: \(error)")
}
}
}
And the PushKit wrapper:
@available(iOS 17.4, *)
@objc class PushKitWrapper : NSObject, PKPushRegistryDelegate {
var pushKitHandler: PuskKitDelegate
var lckHandler: LCKWrapper
@objc init(handler: PuskKitDelegate, lckWrapper: LCKWrapper) {
self.pushKitHandler = handler
self.lckHandler = lckWrapper
super.init()
let mainQueue = DispatchQueue.main
// Create a push registry object on the main queue
let voipRegistry = PKPushRegistry(queue: mainQueue)
// Set the registry's delegate to self
voipRegistry.delegate = self
// Set the push type to VoIP
voipRegistry.desiredPushTypes = [.voIP]
}
func pushRegistry(_ registry: PKPushRegistry, didReceiveIncomingPushWith payload: PKPushPayload, for type: PKPushType) async {
if (type != .voIP) {
return;
}
await self.lckHandler.reportIncomingCall(payload.dictionaryPayload, callerName: "Tester")
}
}
I am developing a VoIP service.
Usually, when receiving a VoIP Push, Callkit is exposed immediately after receiving the message and the app is designed to be used.
However, there is an extremely intermittent phenomenon (not well reproduced) where the app does not wake up even when receiving a VoIP Push. And after a long time, the app wakes up and Callkit is activated. (A long time after receiving the call…)
Has anyone experienced the above phenomenon? I wonder if there are any reported parts depending on the OS version. (I have identified that it does not occur in the 17.x version, but it is difficult to guarantee because it occurs extremely intermittently)
The app is not running in the background, but... Could this be happening if there are a lot of pending operations in the background?
I need help urgently
I am implementing flutter_callkit_incoming for handling call notifications in my Flutter app. However, I am facing an issue where VoIP push notifications are not consistently received when the app is in the background or terminated.
According to Apple’s documentation:
"On iOS 13.0 and later, if you fail to report a call to CallKit, the system will terminate your app. Repeatedly failing to report calls may cause the system to stop delivering any more VoIP push notifications to your app."
I have followed the official installation guide: flutter_callkit_incoming installation and implemented all necessary configurations. However, VoIP notifications sometimes get lost and do not deliver reliably.
Here is the payload I am using:
{
"notification": { "title": "New Alert", "body": "@H is calling you..." },
"android": {
"notification": {
"channelId": "channel_id",
"sound": "sound_name.mp3"
}
},
"apns": { "payload": { "aps": {} } },
"data": {
"title": "New Call",
"body": "@H is calling you...",
"notificationType": "CALL",
"type": "NOTIFICATION",
"sound": "sound_name"
},
"token": "token"
}
I expect the call notification to appear even when the app is in the background or killed state. Has anyone encountered this issue and found a solution? Any insights would be greatly appreciated.
I completed the CallKit Demo with the same code.
When I changed to LiveCommunicationKit, the code goes perfectly when the app is in foreground, but it crashed in background.
If I changed the reportIncoming method from LCK to CallKit, it goes well. What is the reason?
I changed the method from
func pushRegistry(_ registry: PKPushRegistry,
didReceiveIncomingPushWith payload: PKPushPayload,
for type: PKPushType, completion: @escaping () -> Void)
to
func pushRegistry(_ registry: PKPushRegistry,
didReceiveIncomingPushWith payload: PKPushPayload,
for type: PKPushType) async
it crashed before show the print "receive voip noti".
Here is the core code:
var providerDelegate: ProviderDelegate?
func pushRegistry(_ registry: PKPushRegistry,
didReceiveIncomingPushWith payload: PKPushPayload,
for type: PKPushType, completion: @escaping () -> Void) {
if type != .voIP { return }
guard let uuidString = payload.dictionaryPayload["uuid"] as? String,
let uuid = UUID(uuidString: uuidString),
let handle = payload.dictionaryPayload["handle"] as? String,
let hasVideo = payload.dictionaryPayload["hasVideo"] as? Bool,
let callerID = payload.dictionaryPayload["callerID"] as? String else {
return
}
print("receive voip noti: \(type):\(payload.dictionaryPayload)")
if #available(iOS 17.4, *) {
// This code is only goes perfectly when the App is in foreground
var update = Conversation.Update(members: [Handle(type: .generic, value: callerID, displayName: callerID)])
if hasVideo {
update.capabilities = [.video, .playingTones]
} else {
update.capabilities = .playingTones
}
Task { @MainActor in
do {
print("LCKit report start")
try await LCKitManager.shared.reportNewIncomingConversation(uuid: uuid, update: update)
print("LCKit report success")
completion()
} catch {
print("LCKit report failed")
print(error)
completion()
}
}
} else {
// It went perfectly
providerDelegate?.reportIncomingCall(uuid: uuid, callerID: callerID, handle: handle, hasVideo: hasVideo) { _ in
completion()
}
}
@available(iOS 17.4, *)
final class LCKitManager {
static let shared = LCKitManager()
let manager: ConversationManager
init() {
manager = ConversationManager(configuration: type(of: self).configuration)
manager.delegate = self
}
static var configuration: ConversationManager.Configuration {
ConversationManager.Configuration(ringtoneName: "Ringtone.aif",
iconTemplateImageData: #imageLiteral(resourceName: "IconMask").pngData(),
maximumConversationGroups: 1,
maximumConversationsPerConversationGroup: 1,
includesConversationInRecents: true,
supportsVideo: false,
supportedHandleTypes: [.generic])
}
func reportNewIncomingConversation(uuid: UUID, update: Conversation.Update) async throws {
try await manager.reportNewIncomingConversation(uuid: uuid, update: update)
}
}
final class ProviderDelegate: NSObject, ObservableObject {
static let providerConfiguration: CXProviderConfiguration = {
let providerConfiguration: CXProviderConfiguration
if #available(iOS 14.0, *) {
providerConfiguration = CXProviderConfiguration()
} else {
providerConfiguration = CXProviderConfiguration(localizedName: "Name")
}
providerConfiguration.supportsVideo = false
providerConfiguration.maximumCallGroups = 1
providerConfiguration.maximumCallsPerCallGroup = 1
let iconMaskImage = #imageLiteral(resourceName: "IconMask")
providerConfiguration.iconTemplateImageData = iconMaskImage.pngData()
providerConfiguration.ringtoneSound = "Ringtone.aif"
providerConfiguration.includesCallsInRecents = true
providerConfiguration.supportedHandleTypes = [.generic]
return providerConfiguration
}()
private let provider: CXProvider
init( {
provider = CXProvider(configuration: type(of: self).providerConfiguration)
super.init()
provider.setDelegate(self, queue: nil)
}
func reportCall(uuid: UUID, callerID: String, handle: String, hasVideo: Bool, completion: ((Error?) -> Void)? = nil) {
let callerUUID = UUID()
let update = CXCallUpdate()
update.remoteHandle = CXHandle(type: .generic, value: callerID)
update.hasVideo = hasVideo
update.localizedCallerName = callerID
// Report the incoming call to the system
provider.reportNewIncomingCall(with: callerUUID, update: update) { [weak self] error in
completion?(error)
}
}
}
I am developing an App that will enable voice calls between users through webrtc. When the user opens the App and switches the App to the background, the user will receive the incoming call notification through Silent Push Notifications (not PushKit).
My question is as follows,
If set UIBackgroundModes to voip and do not use PushKit and CallKit, will this cause the background App to be unable to use webrtc voice calls (requires network, microphone, and audio permissions)?
Can I set UIBackgroundModes = audio combined with AVAudioSession playAndRecord instead of setting UIBackgroundModes to voip, so that I can use the microphone and audio in the background to implement webrtc voice calls?
Thanks for your help.
We are attempting to update our app to use the PTT framework, as it has been made clear that this will be required in a future iOS version as opposed to using the Unrestricted VoIP entitlement we are using for several features of our app.
However, the behavior of this framework poses some problems with implementing our app's functionality:
It is not possible to programmatically join a channel when the app is not in the foreground. This hinders our ability to implement the Automatically activate radio stream feature of our app, which allows users who have opted into this feature to immediately begin hearing live PTT audio from their agency following an incident alert. Having the app constantly "joined to a channel" and using the restoration delegate could potentially work, however this is not ideal as this would result in the PTT UI needing to be displayed at all times, even when no radio stream is activated.
We have a "Text to Speech" option that, when enabled, reads out the content of an incident alert after the alert sound has played. This currently happens by triggering an AVSpeechSynthesizer in the PushKit incoming push callback. It may be possible to render TTS audio on the fly in a Notification Service Extension and assign it as the notification's sound, if that is possible this is less of a problem.
We also use the PushKit callback to, again if the user has enabled it, activate a "Shake to Respond" feature, allowing a short period of time after receiving an incident alert in which the user can shake their device to indicate that they are responding to the incident. There does not appear to be any way to have the level of background execution required to implement this using an NSE, and this is of course beyond the scope of the PTT framework.
What options do we have to be able to continue to provide this functionality, without risk of it being disabled in a future iOS version?
In mainland China, CallKit is not available. Recently, I discovered LiveCommunicationKit.
Can it replace CallKit?
There is no relevant introduction in the documentation. Can someone help me understand how to use it?
https://developer.apple.com/documentation/livecommunicationkit
Hi everyone,
I am developing a VoIP calling feature in my Flutter app, using:
Agora RTC Engine for real-time calls.
CallKit & PushKit (VoIP notifications) for iOS call handling.
Firebase Cloud Messaging (FCM) for notifications.
Problem: CallKit UI Stays on Screen When Caller Hangs Up (Background/Terminated)
I am using Firebase notifications to notify the receiver that the call should be dismissed, but it doesn’t work in the following cases:
App is in the background – CallKit UI remains stuck even after receiving the Firebase notification.
App is terminated – The Firebase notification does not trigger any background execution, so CallKit UI stays forever.
Current Implementation
I send an FCM notification to inform the receiver to dismiss CallKit UI.
When received in the foreground, it works fine (callEnded method is triggered).
But in background or terminated state, the notification is not received or doesn’t execute the code.
CallKit and WebRTC are used to realize the call functionality.
You can select video, voice, or text calling as your calling method.
When making a text call, the voice input is grayed out and cannot be used, is there a solution?
I am developing an app where the primary feature is to notify users.
To deliver notifications more effectively, I am considering using PushKit and CallKit.
Would it be acceptable under the guidelines to use PushKit and CallKit as an optional feature for an AI agent to notify users via a phone call?
I am developing an application that uses NetworkExtension (Local PUSH function) And VoIP(APNs) PUSH.
Nowadays, I found a problem on this app doesn't handle incoming call of Local PUSH when receiving a Local PUSH after receiving an APNs PUSH.
My confimation result of my app and server log is below.
11:00 AM:
my server(PBX) requests a VoIP(APNs) PUSH notification to the APNs.
But my app does not receive the VoIP(APNs) PUSH.
At this time, my app is running on LAN (Wi-Fi without internet connection), as a result, NetworkExtension was running. so I think this is normal behaviour.
14:55:11 PM:
There is an incoming call from the my server(PBX) via local net, and NetworkExtension calls iOS API(API name is reportIncomingCall).
However, iOS does not call the delegate didReceiveIncomingCallWithUserInfo for the reportIncomingCall.
14:55:11 PM:
At almost the same time, iOS calls the delegate cdidReceiveIncomingPushWithPayload of VoIP PUSH.
(instead of call the delegate didReceiveIncomingCallWithUserInfo for the reportIncomingCall?)
And the content of this VoIP(APNs) PUSH was the incoming call at "11:00 AM".
In other words, the VoIP(APNs) PUSH at 11:00 AM is stuck inside iOS, and at 14:55:11 PM, from NetworkExtension reports it.
I feel there is a problem on iOS doesn't handle incoming call of Local PUSH when receiving a Local PUSH after receiving an VoIP(APNs) PUSH.
Would you tell me Apple's opioion about this?
If this is known problem, Please tell me about it.
I tried below at 2:00 PM on 21/01/2025(JST).
Apple Push Notification service server certificate update
I followed above,
a new server certificate: "SHA-2 Root : USERTrust RSA Certification Authority certificate" was added to my push server, but a certificate error occurred and push notifications could not be sent.
So I refered this article,Instead of connecting via DNS name resolution at api.development.push.apple.com,
I fixed api.development.push.apple.com to "17.188.143.34" in /etc/hosts,
I could push notifications with the new server certificate.
(I got this IP(17.188.143.34) from this airtcle)
From this, I suspect that Apple had not yet updated the APNs certificate (CA) for the Sandbox environment as of 2:00 PM on January 21, 2025 (JST).
Was the update published as scheduled?
I am developing "local push" VoIP application.
I have a question about issues I found while testing this app.
After repeating a test for 24 hours in which a incoming call followed by an immediate disconnect 0.1 seconds later,
the iPhone of incommig call side encountered a 0xBAADCA11 error, causing iOS to force-close the app.
(The incidence is low, occurring three times in 17280 times incoming call(24 hours.))
This problem found on iOS17.6.1 (iPhone11Pro).
When the same test was performed on iOS18.2 (iPhoneSE3), the problem did not occur.
Did iOS take something measures against the 0xBAADCA11 error between iOS17.6.1 and iOS18.2?
If yes, I want to encourage customers to upgrade to the latest iOS version, please tell me about it?
※I have attached an ips files and sysdiagnose file of the 0xBAADCA11 error occurring. (please refer sysdiagnose also if you need.)
FjSoftPhone-2025-01-16-113049.ips
FjSoftPhone-2025-01-16-175253.ips
FjSoftPhone-2025-01-17-070449.ips
[sysdiagnose_2025.01.17_14-24-48+0900_iPhone-OS_iPhone_21G93.tar.gz]
https://drive.google.com/file/d/1CV8laKzdnQxvwaAIOwMcXL8rAYL2jq35/view?usp=sharing
Hello,
I am currently developing a call service using CallKit and VoIP push. Recently, I have encountered a very challenging issue. During testing, when a VoIP push is received, the incomingCall gets triggered continuously, but then it automatically terminates after about 1-2 seconds. I am checking this issue under the debug scheme, and even when switching to different commits, the same problem persists.
I suspect it might be an issue with the device, but I would like to confirm the cause and find a solution. Below are some characteristics I have noticed:
On this device, when a VoIP push is received, CallKit automatically terminates, but this does not occur when debugging.
The issue always occurs when not debugging.
Looking at the device console logs related to callservicesd, there are many logs with 'invalidate' appended.
For example:
Invalidating process assertion for bundle ID from timeout
All calls ended. Clearing system uplink muted cache
Invalidate callDurationUpdateTimer
InCallService has changed process state to 2
InCallService has been suspended; invalidating its XPC client connections.
[0x565544180] invalidated because the current process cancelled the connection by calling xpc_connection_cancel()
XPC connection invalidated from client
These logs appear although our server did not receive any incoming call request, so we did not terminate it on our end. I also checked if there was a crash, but there were no reports left on the device.
Could you please share any insights into the cause or solutions for this situation?
Thank you.
I am trying to add voip call functionality to my app.
It works as expected while the app is in the foreground. But in the background it does not.
I have registered the app as requiring background voip permissions.
My implementation doesn't fit into one of these posts, so here is a gist:
https://gist.github.com/BrentMifsud/4be43c022c1279f04ecb56250a86b3f1
We have just been granted access to the com.apple.developer.usernotifications.filtering entitlement, and are following the documented steps for handled E2EE VOIP notifications listed here: https://developer.apple.com/documentation/callkit/sending-end-to-end-encrypted-voip-calls
1 - A user initiates a VoIP call on their app. Their app then sends an encrypted VoIP call request to your server.
We do exactly this, Alice calls Bob from her app, sending a notification to our servers.
2 - Your server sends the encrypted data to the receiver’s device using a regular remote notification. Be sure to set the apns-push-type header field to alert.
We do exactly this, our server send on a notification to APNS with the apns-push-type header set to alert, destined for Bob.
3 - On the receiver’s device, the notification service extension processes the incoming notification and decrypts it. If it’s an incoming VoIP call, the extension calls reportNewIncomingVoIPPushPayload(_:completion:) to initiate the call. It then silences the push notification (see com.apple.developer.usernotifications.filtering).
I try to do exactly this. The notification is received by the NSE on Bob's device, which decrypts it and then notices it is a VOIP call from Alice. It prepares a dictionaryPayload with the decrypted data and then calls reportNewIncomingVoIPPushPayload(_:) async throws. This throws an NSXPCConnectionInterrupted error, which when logged shows as below:
Error Domain=NSCocoaErrorDomain Code=4097 "connection to service named com.apple.callkit.notificationserviceextension.voip" UserInfo={NSDebugDescription=connection to service named com.apple.callkit.notificationserviceextension.voip}
The only difference I can see to the documentation is that I am working in an asynchronous context so am using the asynchronous version of the method, but I don't imagine this should cause an issue?
I then supress the notification as documented and this works correctly.
Does anyone have any ideas why I am getting this error when calling reportNewIncomingVoIPPushPayload(_:) async throws?
You are probably aware of the upcoming root certificate change for any servers you might have that you use to send push notifications by connection to APNs.
If you are not, here is the announcement.
We have been getting some questions about this, and understand not everyone is familiar with their server setup.
First, we would like to clarify that this is only a change to your server's certificate trust store. You do not need to update anything else, like your APNs push certificates, the build certificates and provisioning profiles for your team/app, and so on. All you need to do is to install the mentioned new root certificate to your push server's trust store.
If you are using a 3rd party push provider, it is them who will need to handle their servers. But you may want to double check with them nevertheless.
If you are managing your own push servers that connect to APNs directly, then it is your responsibility to download and install the root certificate mentioned in the above link on your server(s).
Unfortunately we cannot provide specific instructions on how to install this root certificate on every kind of server out there. Each server operating system/push server software will have different ways these root certificates are installed, which is out of scope of our support abilities.
If you are not sure how to do this, I would recommend you seek help for this from your server-side developers or server admins.
Or, if you don't have access to such resources, you can ask the support channels for your system the question: How do I install a root certificate?
We have setup a test server at 17.188.143.34:443 that you can use to try and send pushes to test whether your new root certificate is correctly installed.
An alternative way to test this would be, from a terminal prompt:
openssl s_client -connect 17.188.143.34:443 -servername api.sandbox.push.apple.com -verifyCAfile USERTrustRSACertificationAuthority.crt -showcerts
Change the parameter to the -verifyCAfile argument to point to your trust store, and it should allow you to validate
Sample return results would be:
Connecting to 17.188.143.34
CONNECTED(00000003)
depth=2 C=US, ST=New Jersey, L=Jersey City, O=The USERTRUST Network, CN=USERTrust RSA Certification Authority
verify return:1
depth=1 CN=Apple Public Server RSA CA 11 - G1, O=Apple Inc., ST=California, C=US
verify return:1
depth=0 C=US, ST=California, O=Apple Inc., CN=api.sandbox.push.apple.com
verify return:1
Argun Tekant /
DTS Engineer /
Core Technologies
I get the error message in Xcode signing certificate
Provisioning profile "iOS Team Provisioning Profile: com.example.app" doesn't include the pushkit entitlement.
I have push notifications ticked in my Identifier in the online developer account. There is no other dedicated pushkit capability available to select.
Push notifications, time sensitive notifications and background mode-> voice over ip are added as capabilities in the Xcode project.
The team provisioning profile for the app states under its enabled capabilities: both push notifications and time sensitive notifications.
Is pushkit part of another capability that I need to select?
I have read the guide below and it just says to add the push notification capability. https://developer.apple.com/documentation/pushkit/supporting-pushkit-notifications-in-your-app
I have gone round and round in circles trying to get this profile to work for this, so any pointers would be much appreciated.
Thanks