9

I'm trying to integrate with iOS10's CallKit, however when I'm trying to initialize the audio session after accept a phone call, this "AudioUnitInitialize" API will throw out this error "AVAudioSessionErrorCodeMissingEntitlement". According to the document, it's just one line explanation: https://developer.apple.com/reference/avfoundation/avaudiosessionerrorcode/avaudiosessionerrorcodemissingentitlement

How should I update the entitlement for support this? Does any body has any experience?

JAL
  • 41,701
  • 23
  • 172
  • 300
Pei
  • 460
  • 4
  • 21
  • I've tried with add a entitlement of "Inter-App-Auido", however it seems not really help, (The "Audio" playing in background mode is already added before). Somehow this exception doesn't happen for every time, it has nearly 10% to initialize the audio session without any problem. Looks like a SDK issue of this beta version? – Pei Jul 05 '16 at 18:59
  • This also happens on Beta 4, so I filed a radar, it will probably be duped but in any case: http://www.openradar.me/27674736 – Víctor Pimentel Aug 03 '16 at 08:26
  • 1
    It also happens in Beta 5 and Beta 6 :( – Víctor Pimentel Aug 16 '16 at 15:49
  • Seeing this still in beta 7. – Zaq Aug 23 '16 at 08:54
  • Any news after release? It still happens for me in 10.0 – Aliaksandr Andrashuk Sep 15 '16 at 12:16

2 Answers2

3

I also ran into this issue in iOS10 Beta 6, and was able to resolve it by moving the "AudioUnitInitialize" API from the performAnswerCallAction: method (as implemented in SpeakerBox) to the init routine of the ProviderDelegate.

By moving initialization earlier in the lifecycle of the ProviderDelegate, somehow the 'entitlement' problem is avoided.

Tico Ballagas
  • 568
  • 4
  • 7
  • Thanks. It also work for me. Btw, can you handle 'Call Fail' button or don't display native UI when the call fail? – sahara108 Oct 24 '16 at 10:05
0

I've downloaded Apple's Speakerbox sample app to examine the entitlements and background modes used for CallKit.

It looks like they add the Background Modes -> voice over IP entitlement and the "App provides Voice over IP services" key to the app's Info.plist:

<key>UIBackgroundModes</key>
<array>
    <string>voip</string>
</array>

It also adds the INStartAudioCallIntent key to NSUserActivityTypes and the following Microphone Usage Description:

<key>NSMicrophoneUsageDescription</key>
<string>$(PRODUCT_NAME) uses the Microphone for call audio</string>
<key>NSCallKitUsageDescription</key>
<string>$(PRODUCT_NAME) makes and receives calls</string>
<key>NSUserActivityTypes</key>
<array>
    <string>INStartAudioCallIntent</string>
</array>
JAL
  • 41,701
  • 23
  • 172
  • 300
  • 1
    Hi JAL, Thanks very much for the reply, however this won't really help, before I post this question, I've already test with this "Speakbox" sample app, the result is it also throw the same exception when initialize the audio session. (It's in the "AudioController.mm", "XThrowIfError(AudioUnitInitialize(_rioUnit)...". If you put a break point in the catch block for this line, you will see it throws exception more than 80%). – Pei Jul 05 '16 at 22:58