且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如果用户拒绝访问摄像头,如何防止WKWebView显示摄像头模式?

更新时间:2023-12-02 10:08:16

因为你提到 __ CRASHING_DUE_TO_PRIVACY_VIOLATION __ 该应用程序可能实际上崩溃了,因为你尚未添加iOS10权限说明以使用麦克风。如果选择视频,摄像机视图将触发此附加麦克风权限弹出窗口。在iOS10中,您必须填写呈现给用户的说明,否则应用程序将在您报告时崩溃。在iOS9中,它只显示通用权限弹出窗口。

Because you mentioned __CRASHING_DUE_TO_PRIVACY_VIOLATION__ the app is probably actually crashing because you haven't added the iOS10 permission description for using the microphone. The camera view will trigger this additional microphone permissions popup if you choose Video. In iOS10, you must fill in the description that is presented to the user or the app will crash as you have reported. In iOS9, it just presents the generic permissions popup.

尝试在 NSMicrophoneUsageDescription 键的描述code> Info.plist 文件。在Xcode中,这称为隐私 - 麦克风使用说明

Try adding a description for the key NSMicrophoneUsageDescription in your Info.plist file. In Xcode this is called Privacy - Microphone Usage Description

其他答案将为您提供各种隐私密钥及其说明的更多详细信息。

This other answer will give you more details of the various privacy keys and their descriptions.