In the foreground, if I use a custom incoming call UI to initiate the call first and then connect to CallKit, it seems to resolve the issue where the microphone cannot be activated properly. But is this approach reasonable?
Post
Replies
Boosts
Views
Activity
When the app is in the foreground, if the CallKit incoming call UI banner is not expand and the call is answered directly, the audio fails to activate successfully. The didActivate method is indeed triggered, and I also called configureAudioSession before reportNewIncomingCall. However, the audio still cannot be configured successfully, resulting in no input or output.
func configureAudioSession() {
let audioSession = AVAudioSession.sharedInstance()
do {
try audioSession.setCategory(.playAndRecord,mode: .voiceChat)
print(" Successed to activate audio session")
} catch {
print(" Failed to activate audio session: \(error)")
}
}