NSPhotoLibraryUsageDescription in Xcode8

喜你入骨 提交于 2019-11-27 04:16:42

问题


Update:
I attempt to add a String value to the "NSPhotoLibraryUsageDescription" key.

And it works.My build version is now available on my TestFlight.

ps: 构建版本 means Build Version

But I want to know why Apple Store just let me add String value for "NSPhotoLibraryUsageDescription" key rather than "Camera Usage Description" or "Location When In Use Usage Description"? And how to localize the info.plist.


Old:
I've uploaded many build versions to iTunes Connect.But TestFlight shows none of these build versions.
Then I search this issue on stackoverflow. And I know this is caused by usage description. I add the NSPhotoLibraryUsageDescription in my Info.plist. However, Apple Store team email and tell me that:

Dear developer,

We have discovered one or more issues with your recent delivery for "Family Health Tracker". To process your delivery, the following issues must be corrected:

This app attempts to access privacy-sensitive data without a usage description. The app's Info.plist must contain an NSPhotoLibraryUsageDescription key with a string value explaining to the user how the app uses this data.

Once these issues have been corrected, you can then redeliver the corrected binary.

Regards,

The App Store team

They still tell me add NSPhotoLibraryUsageDescription


回答1:


Localizing of info.plist file may be very unuseful, especially if you use many languages in your apps. The simplest way for localizing NSPhotoLibraryUsageDescription, NSLocationWhenInUseUsageDescriptionor NSCameraUsageDescription keys is to describe it in InfoPlist.strings file.

  • Create new *.strings file with name InfoPlist;
  • Press Localize... button in file inspector and choose the default language;
  • Add new records in your new InfoPlist.strings file. For example in English:

NSLocationWhenInUseUsageDescription = "Location usage description";

NSPhotoLibraryUsageDescription = "Photos usage description";

NSCameraUsageDescription = "Camera usage description";

For more information Apple docs




回答2:


Make sure that "NSPhotoLibraryUsageDescription" has value assigned before uploading the app to iTunesConnect.




回答3:


Simply add these lines to your info.plist file

<key>NSPhotoLibraryUsageDescription</key>
<string>Photo Library Access Warning</string> //For NSPhotoLibraryUsageDescription issue.



回答4:


To localize the Info.plist:

  • Click your Info.plist
  • Show your Utilities, then click File inspector
  • This is a button Localize, click it.



回答5:


Try this it work for us,

<key>NSPhotoLibraryUsageDescription</key>
<string>This app requires access to the photo library.</string>

For more details please refer Best Answer

Hope this will help for some .




回答6:


I had the same problem with two applications, the solution shows you the itunnes connect via mail: info.plist review your file and tries to add the following fields:

  Privacy - Photo Library Usage Description

  Bluetooth Sharing - NSBluetoothPeripheralUsageDescription

each with a text explaining the reason for its use. You can check here the permissions that now requires iOS 10 in its info.plist here: https://blog.xamarin.com/new-ios-10-privacy-permission-settings/

This worked for me.




回答7:


The missing keys are related to some APIs requiring some usage descriptions defined in the .plist keys. Before adding any keys if you know that your app doesn't make any specific usage I will recommend you take a look at this official guide from Apple to identity faulty API classes. As an example I simply have a comment out on a line containing UIImagePickerController. This was enough to get the binary rejection from Apple; while I didn't access to the user photo library. Once you validated this step you can go ahead with other solutions mentioned here.



来源:https://stackoverflow.com/questions/39432242/nsphotolibraryusagedescription-in-xcode8

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!