目前我正在开发录制音频的录音应用程序,因此我在info.plist文件中设置了麦克风权限,因此记录了iOS 10.3.2中显示的audion权限警报,但它没有出现在iOS 10.3.3设备中。
请求许可的代码
let session:AVAudioSession = AVAudioSession.sharedInstance()
do {
try session.overrideOutputAudioPort(AVAudioSessionPortOverride.none)
if (session.responds(to: #selector(AVAudioSession.requestRecordPermission(_:)))) {
AVAudioSession.sharedInstance().requestRecordPermission({(granted: Bool)-> Void in
if granted {
print("Permission to record granted")
self.setSessionPlayAndRecord()
if setup {
self.setupRecorder()
}
UIApplication.shared.beginReceivingRemoteControlEvents()
self.recorder?.record()
} else {
print("Permission to record not granted")
}
})
} else {
print("requestRecordPermission unrecognized")
}
//Start Record
/* self.setSessionPlayAndRecord()
if setup {
self.setupRecorder()
}
UIApplication.shared.beginReceivingRemoteControlEvents()
self.recorder?.record()*/
} catch let error as NSError {
print("Audio Session error: \(error.localizedDescription)")
}
由于