在我的录音应用程序中,我试图让用户访问麦克风。但是,我一直得到.NotDetermined案例,没有提示。文档说明Not Determined案例会提示用户,但情况似乎并非如此。
@IBAction func recordTapped(recordButton: UIButton!){
let microPhoneStatus = AVCaptureDevice.authorizationStatusForMediaType(AVMediaTypeAudio)
switch microPhoneStatus {
case .Authorized:
// Has access
println("access")
vibrate()
recordNow()
case .Denied:
// No access granted
println("denied")
case .Restricted:
// Microphone disabled in settings
println("mic disabled in settings")
case .NotDetermined:
// Didn't request access yet
AVCaptureDevice.requestAccessForMediaType(AVMediaTypeAudio, completionHandler: nil)
println("Not determined")
}
}