Is there a way to ask user for Camera access after they have already denied it on iOS?

后端 未结 4 1092
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-07 12:35

I am using this code, but unfortunately it doesn\'t work.

After a user has denied camera access, I want to ask them for permission to use the camera again the next t

4条回答
  •  庸人自扰
    2020-12-07 12:59

    Once they have denied camera access, the user can authorize camera use for your app in Settings. By design, you can't override this in your own code.

    You can detect this case with the following sample code and then explain to the user how to fix it: iOS 7 UIImagePickerController Camera No Image

    NSString *mediaType = AVMediaTypeVideo; // Or AVMediaTypeAudio
    
    AVAuthorizationStatus authStatus = [AVCaptureDevice authorizationStatusForMediaType:mediaType];
    
    // The user has explicitly denied permission for media capture.
    else if(authStatus == AVAuthorizationStatusDenied){
        NSLog(@"Denied");
    }
    

提交回复
热议问题