Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NSPhotoLibraryAddUsageDescription error

I hope someone can help here. I have this Xcode / Unity project, and every time I try to build it I get this error:

This app has crashed because it attempted to access privacy-sensitive data without a usage description. The app's Info.plist must contain an NSPhotoLibraryAddUsageDescription key with a string value explaining to the user how the app uses this data.

I understand that in my info.plist I need a description for use of camera, library etc, but as far as I can see, I have that?

Here is my 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>[email protected]</string>
      <string>[email protected]</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:[email protected]/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>

As you can see, i do have the descriptions in there?!?!

When viewing the info.plist inside Xcode it looks like this

enter image description here

really hope that someone can help me in this matter, and thanks in advance :-)

like image 989
Mansa Avatar asked Dec 18 '22 03:12

Mansa


1 Answers

You need to add below code in info.plist

<key>NSPhotoLibraryAddUsageDescription</key>
<string>Here write description why you accessing photo library</string>

Privacy - Photo Library Usage Description is for read and write libraries, NSPhotoLibraryAddUsageDescription is only for read. If your app needs only read add NSPhotoLibraryAddUsageDescription

For more details see this link, https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html#//apple_ref/doc/uid/TP40009251-SW73

See the below screenshots:

1) Right click on Info.plist file

--> Select Open As option

--> Click Source Code

enter image description here

2) Now copy and paste above code here.

enter image description here

like image 58
Naresh Avatar answered Dec 20 '22 15:12

Naresh