HomeiOS Developmentios - Can't present digital camera permission alert once more when triggering...

ios – Can’t present digital camera permission alert once more when triggering AVCaptureDevice.requestAccess once more


I attempt to reset the digital camera permission by inject a .notDetermined worth to AVAuthorizationStatus. And I may see in under code AVCaptureDevice.requestAccess(for: .video) is retriggered, nevertheless the digital camera alert will not be introduced once more on iPhone.

My query is that if AVCaptureDevice.requestAccess(for: .video) will do recheck in some DB for the AVAuthorizationStatus, or it simply pops the permission alert, wherein means I ought to have the alert on iPhone. And the place the digital camera permission is saved in iPhone, any persistent storage, and may we clear that storage in code?

And undergo a number of posts already, they recommendation to uninstall the app, however in automation UI take a look at, we can not uninstall an app from what I do know.

    non-public var isAuthorized: Bool {
        get async {
            // If UI Take a look at, inject AVAuthorizationStatus = .notDetermined
            let standing = RuntimeEnv.isUITest ? .notDetermined : AVCaptureDevice.authorizationStatus(for: .video)
            
            var isAuthorized = standing == .licensed
            
            if standing == .notDetermined {
                isAuthorized = await AVCaptureDevice.requestAccess(for: .video)
            }

            return isAuthorized
        }
    }

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments