How to Localize NSPhotoLibraryUsageDescription key (ALAssets)

I’m trying to localize the NSPhotoLibraryUsageDescription key defined in the application’s info.plist file (reference here).
This key gives you a point to provide custom message when the app is first asking for access to your camera roll.
I’m using ALAssetsLibrary to enumerate assets groups (which triggers the access request message to pop-up).

So far my googling doesn’t answer how I could achieve this.

  • Display List of Episodes from List of Podcasts
  • What properties can I set via an UIAppearance proxy?
  • how some apps can open setting app programmatically within their app
  • Display video inside the Uiwebview not in device full screen
  • .app file not found in Derived Data
  • Error while trying to validate an iOS application before uploading it to the AppStore
  • I want to avoid localizing the whole info.plist file as it contain a lot more non-locale dependent content.

    Anyone already solved this or have hints how to proceed?

    2 Solutions Collect From Internet About “How to Localize NSPhotoLibraryUsageDescription key (ALAssets)”

    There is a file you can create (which may be created for you when you create a project) called InfoPlist.strings. This file is used and localized much like the file Localizable.strings.

    In it you would have and entry something like:

    NSPhotoLibraryUsageDescription = "Test of new Photos warnings";
    

    Note that there are no quotation marks around the key

    I think as long as the key is included in info.plist, it will localized using the value in InfoPlist.string if it is available for the language. Otherwise it will use whatever is defined in info.plist.

    I have my note here https://github.com/onmyway133/notes/issues/290, or you will get

    Missing Info.plist key – 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.

    Make sure

    • You declare the keys in Info.plist
    • You localize it in InfoPlist.strings
    • You don’t need double quotes, like "NSPhotoLibraryUsageDescription" = "Test of new Photos warnings";, you can just use NSPhotoLibraryUsageDescription = "Test of new Photos warnings";