XCode 10.1 successfully performed the migration, but after I performed a Build some errors crept in. Here is one example:
func setPlayAndRecordMode() {
let audioSession = AVAudioSession.sharedInstance()
if convertFromAVAudioSessionCategory(audioSession.category) == convertFromAVAudioSessionCategory(AVAudioSession.Category.playAndRecord) && convertFromAVAudioSessionMode(audioSession.mode) == convertFromAVAudioSessionMode(AVAudioSession.Mode.measurement) {
return
}
do {
try audioSession.setCategory(AVAudioSession.Category(rawValue:
convertFromAVAudioSessionCategory(AVAudioSession.Category.playAndRecord)), mode: AVAudioSession.Mode) (**error message**: Editor placeholder in source file)
try audioSession.setMode(AVAudioSession.Mode.measurement)
} catch {
print(error)
}
}
Any thoughts and suggestions appreciated.
You need to pass your mode for example moviePlayBack
, spokenAudio
etc.. check a complete list here , as an example I passed spokenAudio
on your line as shown below.
convertFromAVAudioSessionCategory(AVAudioSession.Category.playAndRecord)), mode: AVAudioSession.Mode.spokenAudio)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.