问题
I am working with VOIP app. The app is working fine with CallKit.
I am facing an issue if alarm fires within call. Every time when alarm stop firing (Audio Interruption ends), we are trying to setActive: on AVAudioSession. But it always gives an error with code 1701737535 ie. 'ent?'.
The same error occurs when I am trying to initialize Audio Unit. Without using CallKit it's working fine.
Anybody faced issue with activating Audio Session when Audio Interruption ends.
I am getting different error '!pri' 561017449 in the same scenario but this time Interruption occurred because of the Native Phone app.
Issues are 100% replicable. tried with many hit & trails like thread, delay or calling setActive:YES and without calling setActive:YES. But no luck.
Summarising here :
Getting error 1701737535 ie. 'ent?' if interruption because of ALARM.
Getting error 561017449 ie. '!pri' if interruption because of Native Call
Replicating only if using CallKit with VIOP.
Anybody help.
回答1:
I've run into the same issue, the solution I've found and worked with me is to enable Audio session before reporting your new call.
// Activate audio session
do {
try AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayAndRecord, mode: AVAudioSessionModeVoiceChat, options: [.mixWithOthers, .allowBluetoothA2DP])
try AVAudioSession.sharedInstance().setActive(true)
} catch {
}
provider.reportNewIncomingCall(with: currentCallID, update: update, completion: { error in })
来源:https://stackoverflow.com/questions/49877932/audiounitinitialize-failed-with-error-code-1701737535-ent-after-alarm-interru