📅  最后修改于: 2022-03-11 15:01:03.589000             🧑  作者: Mango
import AVFoundation
switch AVAudioSession.sharedInstance().recordPermission {
case AVAudioSessionRecordPermission.granted:
print("Permission granted")
case AVAudioSessionRecordPermission.denied:
print("Pemission denied")
case AVAudioSessionRecordPermission.undetermined:
print("Request permission here")
AVAudioSession.sharedInstance().requestRecordPermission({ (granted) in
// Handle granted
})
}