如何处理这个错误AVAudioSessionErrorCodeMissingEntitlement?

时间:2016-06-29 22:32:19

标签: ios audio entitlements ios10 callkit

我正在尝试与iOS10的CallKit集成,但是当我在接受电话呼叫后尝试初始化音频会话时,此“AudioUnitInitialize”API将抛出此错误“AVAudioSessionErrorCodeMissingEntitlement”。 根据该文件,这只是一行解释: https://developer.apple.com/reference/avfoundation/avaudiosessionerrorcode/avaudiosessionerrorcodemissingentitlement

我应该如何更新支持权利?有没有经验?

2 个答案:

答案 0 :(得分:3)

我也在iOS10 Beta 6中遇到过这个问题,并且能够通过将{AudioInitInitialize} API从defmodule Pghm.SightingView do use Pghm.Web, :view def render("sighting.json", %{sighting: sighting}) do %{what: sighting.what, lat: sighting.lat, long: sighting.long} end def render("index.json", %{sightings: sightings}) do %{data: render_many(sightings, Pghm.SightingView, "sighting.json")} end def render("show.json", %{sighting: sighting}) do %{data: render_one(sighting, Pghm.SightingView, "sighting.json")} end end 方法(在SpeakerBox中实现)移动到performAnswerCallAction:例程来解决它。 ProviderDelegate。

通过在ProviderDelegate生命周期的早期移动初始化,可以避免“权利”问题。

答案 1 :(得分:-1)

我已下载Apple的Speakerbox示例应用,以检查用于CallKit的权利和背景模式。

看起来他们添加了背景模式 - >应用程序的Info.plist中的IP语音权利和“应用程序提供IP语音服务”键:

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

它还会将INStartAudioCallIntent键添加到NSUserActivityTypes以及以下麦克风使用说明:

<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>