我希望有人可以在这里提供帮助。我有这个Xcode / Unity项目,每次我尝试构建它时都会收到此错误:
此应用已崩溃,因为它试图访问隐私敏感 没有使用说明的数据。应用程序的Info.plist必须包含 带有字符串值的NSPhotoLibraryAddUsageDescription键 向用户解释应用程序如何使用此数据。
我知道在我的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>CFBundleDisplayName</key>
<string>MyGame</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIconFiles</key>
<array>
<string>AppIcon57x57.png</string>
<string>AppIcon57x57@2x.png</string>
<string>AppIcon60x60@2x.png</string>
<string>AppIcon72x72@2x~ipad.png</string>
<string>AppIcon72x72~ipad.png</string>
<string>AppIcon76x76@2x~ipad.png</string>
<string>AppIcon76x76~ipad.png</string>
</array>
<key>CFBundleIdentifier</key>
<string>com.mycompany.${PRODUCT_NAME}</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.3</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true />
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true />
</dict>
<key>UIApplicationExitsOnSuspend</key>
<false />
<key>UILaunchStoryboardName~ipad</key>
<string>LaunchScreen-iPad</string>
<key>UILaunchStoryboardName~iphone</key>
<string>LaunchScreen-iPhone</string>
<key>UILaunchStoryboardName~ipod</key>
<string>LaunchScreen-iPhone</string>
<key>UIPrerenderedIcon</key>
<false />
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UIRequiresFullScreen</key>
<true />
<key>UIRequiresPersistentWiFi</key>
<false />
<key>UIStatusBarHidden</key>
<true />
<key>UIStatusBarStyle</key>
<string>UIStatusBarStyleDefault</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
</array>
<key>Unity_LoadingActivityIndicatorStyle</key>
<integer>-1</integer>
<key>UnityCloudProjectID</key>
<string>xxx-xxx-xxx-xxx-xxx</string>
<key>UnityCrashSubmissionURL</key>
<string>https://a:b@perf-events.cloud.unity3d.com/symbolicate</string>
<key>NSCameraUsageDescription</key>
<string>Used for profile image</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Used for profile image</string>
<key>FacebookAppID</key>
<string>xxxxx</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>facebook-unity-sdk</string>
<key>CFBundleURLSchemes</key>
<array>
<string>xxxxx</string>
</array>
</dict>
</array>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>fbapi</string>
<string>fb-messenger-api</string>
<string>fbauth2</string>
<string>fbshareextension</string>
</array>
</dict>
</plist>
如您所见,我的确有说明吗?!?!
在Xcode中查看info.plist时,它看起来像这样
真的希望有人可以帮助我解决这个问题,并提前感谢: - )
答案 0 :(得分:4)
您需要在info.plist中添加以下代码
<key>NSPhotoLibraryAddUsageDescription</key>
<string>Here write description why you accessing photo library</string>
隐私 - 照片库使用说明适用于读写库, NSPhotoLibraryAddUsageDescription仅供阅读。如果您的应用只需阅读,请添加NSPhotoLibraryAddUsageDescription
请参阅以下屏幕截图:
1)右键单击Info.plist文件
- &GT;选择打开方式选项
- &GT;单击源代码
2)现在复制并粘贴上面的代码。
答案 1 :(得分:3)
您需要在iOS 11中的info.plist
文件中添加NSPhotoLibraryAddUsageDescription
。
如果您想在照片库中添加照片/图像,则必须将此密钥添加到info.plist文件
答案 2 :(得分:1)
我发现你还需要添加
<key>NSCameraUsageDescription</key>
<string>Photo Library Access Warning</string>
或者它仍然会崩溃。 你现在需要这三个人 - 2018年3月