首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >NSPhotoLibraryAddUsageDescription错误

NSPhotoLibraryAddUsageDescription错误
EN

Stack Overflow用户
提问于 2017-10-06 08:49:58
回答 3查看 8.8K关注 0票数 5

我希望有人能帮上忙。我有这个Xcode /,每次我试图构建它时,我都会得到以下错误:

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

据我所知,在我的info.plist中,我需要对相机、库等的使用进行描述,但据我所见,我有吗?

这是我的info.plist:

代码语言:javascript
复制
<?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时,如下所示

真希望有人能在这件事上帮我,谢谢:-)

EN

回答 3

Stack Overflow用户

发布于 2017-11-03 07:02:21

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

代码语言:javascript
复制
<key>NSPhotoLibraryAddUsageDescription</key>
<string>Here write description why you accessing photo library</string>

隐私-图片库的使用说明用于读写库,NSPhotoLibraryAddUsageDescription只用于读取。如果您的应用程序只需要阅读,添加NSPhotoLibraryAddUsageDescription

有关详细信息,请参阅此链接,ref/doc/uid/TP40009251-SW73

见以下截图:

1)右键单击Info.plist文件

->选择Open选项

->点击源代码

2)现在在这里复制和粘贴上面的代码,

票数 7
EN

Stack Overflow用户

发布于 2017-10-06 08:50:51

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

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

票数 3
EN

Stack Overflow用户

发布于 2018-03-08 01:08:37

我发现你还需要

代码语言:javascript
复制
<key>NSCameraUsageDescription</key>
<string>Photo Library Access Warning</string>

否则它还是会崩溃的。你现在需要这三个人-2018年3月

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/46601885

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档