Hello Apple Developer Community,
We're implementing the PushToTalk framework as recommended. According to Apple engineers in previous forum responses :
the framework allows your app to continue receiving push notifications even after your app is terminated or the device is rebooted.
Implementation:
We've properly implemented:
- Early initialization of PTChannelManager via channelManager(delegate:restorationDelegate:completionHandler:)
- Channel joining with requestJoinChannel(channelUUID:descriptor:) when foregrounded
- All required delegate methods
Issue
After a user force quits our app, PushToTalk functionality works briefly but fails after some time (minutes to hours). The system logs show:
AudioSessionServerImpCommon.mm:105 {
"action":"cm_session_begin_interruption",
"error":"translating CM session error",
"session":{"ID":"0x72289","name":"getcha(2958)"},
"details":{
"calling_line":997,
"error_code":-12988,
"error_string":"Missing entitlement"
}
}
We suspect that entitlement after force-quitting the app, there's a permission cache that temporarily allows functionality, but once this cache is cleared, the features stop working. Without this entitlement, both audio playback and recording fail, completely breaking the PTT functionality.
Questions
- Which specific entitlement is missing according to this error?
- Is there a permission caching mechanism that expires after force quit?
- How can we ensure reliable PTT operation after force quit as stated in documentation?
This behavior contradicts Apple's guidance that PushToTalk should work reliably after termination. Any insights would be greatly appreciated.
Thank you!
We suspect that entitlement after force-quitting the app, there's a permission cache that temporarily allows functionality, but once this cache is cleared, the features stop working. Without this entitlement, both audio playback and recording fail, completely breaking the PTT functionality.
Basically, no, this isn't what's going on.
The thing to understand here is that the entitlement system isn't just used to constrain app behavior, it's ALSO used to constrain what exactly the system can do. For example, apps are not allowed to activate recording audio sessions unless they're in the foreground, but this is fact EXACTLY the functionality CallKit provides to voip apps. The architecturally, how that's actually implemented an entitlement exists which allows background activation and that entitlement is then granted to the specific system components (like callservicesd).
However, that does sometimes lead to misleading error messages* (like this one) where the error says "your missing an entitlement" when what it actually means is "you tried to do something your simply not allowed to do".
*Accessing HomeKit from the background is another example of this. On some platforms our error string says an entitlement is missing, but as far as I'm aware we've never granted that entitlement to anyone. The real error is simply that apps are not allowed to access HomeKit from the background.
In any case, the entitlement itself is a distraction. The issue here isn't that your app needs some extra entitlement, it's that it tried to do "something" the system doesn't allow.
So, let me return to here:
How can we ensure reliable PTT operation after force quit as stated in documentation?
The first issue I'd immediately look at is whether or not your app ever directly activates the audio session, as that's the easiest way generate this kind of failure. Note that this can be particularly tricky if you've moved an existing PTT app onto the PushToTalk framework.
The issue in that case is that legacy PTT apps regularly "flipped" between a mixable playback-only session (so they could immediately play over/alongside other audio) and the CallKit session (so they could record). If that older playback-only code is still in the app, it can end up creating race conditions where things work "most" of the time (because you're calling activate on a mixable playback-only session) and then fail unexpectedly (because the session configuration shifted to the PTT config).
__
Kevin Elliott
DTS Engineer, CoreOS/Hardware