2

我正在尝试打开用户的相机,但每当我尝试打开相机时,我都会收到此错误,“应用程序已崩溃,因为它试图在没有使用说明的情况下访问隐私敏感数据。应用程序的 Info.plist 必须包含NSCameraUsageDescription 键,带有一个字符串值,向用户解释应用程序如何使用这些数据。” 我已经在 info.plist 文件中添加了隐私 - 相机使用说明以及诸如“我需要使用您的相机”之类的值,但我仍然收到此错误。这是我的 info.plist 源代码

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>CFBundleDevelopmentRegion</key>
    <string>en</string>
    <key>CFBundleExecutable</key>
    <string>$(EXECUTABLE_NAME)</string>
    <key>CFBundleIdentifier</key>
    <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
    <key>CFBundleInfoDictionaryVersion</key>
    <string>6.0</string>
    <key>CFBundleName</key>
    <string>$(PRODUCT_NAME)</string>
    <key>CFBundlePackageType</key>
    <string>APPL</string>
    <key>CFBundleShortVersionString</key>
    <string>1.0</string>
    <key>CFBundleVersion</key>
    <string>1</string>
    <key>LSRequiresIPhoneOS</key>
    <true/>
    <key>NSLocationWhenInUseUsageDescription</key>
    <string>Needed to receive your current location.</string>
    <key>NSCameraUsageDescription</key>
    <string>Need to use camera for AR</string>
    <key>UILaunchStoryboardName</key>
    <string>LaunchScreen</string>
    <key>UIMainStoryboardFile</key>
    <string>Main</string>
    <key>NSAppTransportSecurity</key>
    <dict>
        <key>NSAllowsArbitraryLoads</key>
        <true/>
    </dict>
    <key>UIRequiredDeviceCapabilities</key>
    <array>
        <string>armv7</string>
    </array>
    <key>UISupportedInterfaceOrientations</key>
    <array>
        <string>UIInterfaceOrientationPortrait</string>
        <string>UIInterfaceOrientationLandscapeLeft</string>
        <string>UIInterfaceOrientationLandscapeRight</string>
    </array>
</dict>
</plist>

***我找到了解决方案。我必须进入“信息”并在自定义 IOS 目标属性中添加隐私密钥

4

1 回答 1

0

奇怪的是,在 iOS 10 之后,您必须定义对所有硬件的访问权限。您很可能会错过“隐私麦克风使用说明”。切换到“组织者”并查看设备上的崩溃报告并添加那里列出的所有隐私错误。

于 2017-03-14T23:50:48.327 回答