Ios NSPhotoLibraryAddUsageDescription错误

Ios NSPhotoLibraryAddUsageDescription错误,ios,xcode,camera,plist,Ios,Xcode,Camera,Plist,我希望这里有人能帮忙。我有一个Xcode/Unity项目,每次我尝试构建它时都会出现以下错误: 此应用程序已崩溃,因为它试图访问隐私敏感应用程序 没有使用说明的数据。应用程序的Info.plist必须包含 具有字符串值的NSPhotoLibraryAddUsageDescription密钥 向用户解释应用程序如何使用这些数据 我知道在我的info.plist中,我需要一个关于相机、图书馆等使用的说明,但据我所知,我有吗 这是我的信息列表: <?xml version="1.0" encod

我希望这里有人能帮忙。我有一个Xcode/Unity项目,每次我尝试构建它时都会出现以下错误:

此应用程序已崩溃,因为它试图访问隐私敏感应用程序 没有使用说明的数据。应用程序的Info.plist必须包含 具有字符串值的NSPhotoLibraryAddUsageDescription密钥 向用户解释应用程序如何使用这些数据

我知道在我的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>

CfBundledDevelopmentRegion
EN
CbundleDisplayName
魔幻战士
Cbundlexecutable
${EXECUTABLE_NAME}
CFBundleIconFiles

真的希望有人能在这件事上帮助我,并提前感谢:-)

您需要在iOS 11中添加
info.plist
文件


如果要在照片库中添加照片/图像,则必须将此密钥添加到info.plist文件中

您需要在info.plist中添加以下代码

<key>NSPhotoLibraryAddUsageDescription</key>
<string>Here write description why you accessing photo library</string>
NSPhotoLibraryAddUsageDescription
在这里写下您访问照片库的原因
隐私-照片库使用说明适用于读写库, NSPhotoLibraryAddUsageDescription仅用于读取。如果您的应用只需要阅读添加NSPhotoLibraryAddUsageDescription

有关更多详细信息,请参阅此链接

请参见以下屏幕截图:

1)右键单击Info.plist文件

-->选择打开作为选项

-->单击源代码

2)现在将上述代码复制并粘贴到此处


我发现您还需要添加

<key>NSCameraUsageDescription</key>
<string>Photo Library Access Warning</string>
NSCameraUsageDescription
照片库访问警告
否则它仍然会崩溃。
您现在需要这三个条目—2018年3月

错误说明您的plist需要有
NSPhotoLibraryAddUsageDescription
条目,而您的plist没有。这个错误到底有什么不清楚的地方?可能是@VarunNaharia的副本是对的,可以结束这个问题吗?文档上说:“NSPhotoLibraryUsageDescription(String-iOS)通过此键,您可以描述应用程序访问用户照片库的原因。虽然此键控制对用户照片库的读写访问,但如果您的应用程序只需要向库中添加资产,而不需要读取任何资产,则最好使用NSPhotoLibraryAddUsageDescription。”关于为什么使用AddUsage键,当使用密钥(每个文档)控制读写访问时,是否需要定义为仅写?