Is it mandatory to add NSPhotoLibraryUsageDescription in info.plist? - ios

I am not using UIImagePicker in my app and not accessing the Photo Library. I got a mail regarding add NSPhotoLibraryUsageDescription in info.plist file.
I have following questions
How to confirm my project accessing the photo library?
I already searched UIImagePicker in my project and did't get any result.
Is it mandatory to add NSPhotoLibraryUsageDescription in info.plist while i am not accessing the photo library?
Can any one help to find it out .
Thanks

UIImagePicker
An image picker controller manages user interactions and delivers the results of those interactions to a delegate object. The role and appearance of an image picker controller depend on the source type you assign to it before you present it.
whenever you used UIImagePicker, you have to give permission for that particular application
There is a list of all Cocoa Keys that you can specify in your Info.plist file:
https://developer.apple.com/library/content/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html
(Xcode target -> Info -> Custom iOS Target Properties)
iOS already required permissions to access microphone, camera, and media library earlier (iOS6, iOS7), but since iOS10 the apps will crash if you don't provide the description why you are asking for the permission.
UPDATE:
Summary of all privacy keys (with example description):
Useful Link

You only have to add this key-value pair to your info.plist if you are actually accessing the photos any way. If it's not added the app is going to crash.
Check if any of your added dependencies using UIImagePicker.

No it's not mandatory to add NSPhotoLibraryUsageDescription key in info.plist. If your App is not using accessing photo from library/gallery then you should remove it. But as "#Bence Pattogato" said if Your app accessing photo from library/gallery and there is no key added in info.plist then it will be crash.
For your information below are different keys that required to add info.plist if you accessing relevant features according to camera/photo library.
1) NSPhotoLibraryUsageDescription : This key lets you describe the reason your app accesses the user’s photo library. When the system prompts the user to allow access, this string is displayed as part of the alert.
2) NSCameraUsageDescription : describes the reason that the app (including an iMessage app) accesses the device’s camera. When the system prompts the user to allow access, this string is displayed as part of the alert.
3) NSPhotoLibraryAddUsageDescription : (New in iOS 11) This key lets you describe the reason your app seeks write-only access to the user’s photo library. When the system prompts the user to allow access, this string is displayed as part of the alert.
Above information get from this Appel official link.

Related

NSLocationWhenInUseUsageDescription inside library Info.plist

I've built a Swift library that uses CoreLocation for fetching user location when the app is in use. If I want to integrate my library inside an app, I only need to import the library, instantiate my class and start the method that gets user location...
...And I also need to add NSLocationWhenInUseUsageDescription inside the app Info.plist!
I was wondering if it is possible to add the NSLocationWhenInUseUsageDescription inside the library Info.plist to let the programmer choose if implement a custom description or leave the default library description.
P.S. I've already added the NSLocationWhenInUseUsageDescription inside the library Info.plist, but Xcode is not happy if I decide not to add it also in the app Info.plist:
This app has attempted to access privacy-sensitive data without a usage description. The app's Info.plist must contain an NSLocationWhenInUseUsageDescription key with a string value explaining to the user how the app uses this data
Thanks a lot in advance!
No, this is not possible.
You will need to instruct the library user that they need to add the location usage key to their app's info.plist.
They will need to add a description that is appropriate for their app's usage of location

Xcode: Missing Info.plist key for NSCameraUsageDescription

After adding GPUImage to my Xcode project, my app is getting denied for Missing an Info.plist key for NSCameraUsageDescription.
Missing Info.plist key - This app attempts to access privacy-sensitive
data without a usage description. The app's Info.plist must contain an
NSCameraUsageDescription key with a string value explaining to the
user how the app uses this data.
I have added the key and description to my plist in several different ways and over 10 builds have all gotten the same denial error.
Here is my info.plist with the Camera Usage key at the bottom.
Any ideas on why I still get denied when I clearly have this defined in my plist?
You need to put a particular and proper description to use Camera in your application. One my application is denied due to improper description. So try with a proper description, maybe it will help you.
<key>Privacy - Camera Usage Description</key>
<string>APPNAME requires access to your phone’s camera.</string>
Ok it is an old one but i'd share my experience... nothing was working for me.
What i add to to was :
using Xcode to edit the plist.info. NOT in an external editor !!!!
DO NOT edit the text CREATE a new key using the + sign.
it will ask you to replace the previous (unless the previous one has been entered wrong... my case i think)
Try the both Camera and Library permission in Plist.
<key>NSCameraUsageDescription</key>
<string>Access camera</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Library</string>
I know this is an older post, but for me, it took an hour to discover that I was not editing the correct Info.plist file, but the one for UI Tests. Double-check which one you are editing, it can be the cause.
You should enter the purpose of using camera as the description. If it does not give the purpose app will get rejected.
you should add something like
Appname requires to access camera for taking profile picture or Appname requires to access camera for uploading product images
From the apple: Check this link.
To protect user privacy, an iOS app linked on or after iOS 10.0, and
that accesses the device’s camera, must statically declare the intent
to do so. Include the NSCameraUsageDescription key in your app’s
Info.plist file and provide a purpose string for this key. If your app
attempts to access the device’s camera without a corresponding purpose
string, your app exits.
I got the same error as OP. I don't know why though because I wasn't using anything related to the camera in my app. So I included this as the description and worked.
"AppName does not use the camera to capture to take a profile picture or upload profile photos."
GPUImage is for capturing image and video, i guess adding Microphone permission might solve the issue
<key>NSCameraUsageDescription</key>
<string>Need to access your camera to capture a picture and record a video.</string>
<key>NSMicrophoneUsageDescription</key>
<string>Need to access your microphone to record a video.</string>
try!
<key>NSCameraUsageDescription</key>
<string>Need to access your camera to capture a photo add and update profile picture.</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Need to access your photo library to select a photo add and update profile picture</string>
I have the same problem even I add the privacy-Camera Usage Description in the info.plist. I try to clean and rebuild the project. Reopen the Xcode. Everything doesn't work until I add the privacy-Camera Usage Description in the Custom ios Target Properties. Hope it solve your problem.
For app store submission, The Usage description should briefly explain why we really needs that feature.
Description:
Camera Use
is too short and doesn't explains why we actually need camera.
It should be something like:
App Needs to use camera to take Profile picture
If you write
Privacy - Camera Usage Description,
change to
NSCameraUsageDescription
you have to put accurate condition in front of any policy, "camera use" is wrong
here, and for this specific problem you have to put "AVCaptureDeviceInput" in front of privacy. Hope it will work for you.
For more you can go to this link and check other privacy policy as well.
https://developer.apple.com/library/content/qa/qa1937/_index.html
let me know about the result.
Try the following things:
Delete deriveddata
Make sure you are not editing the ones in test folders.
Increase development ios version to 11.0

iOS - App crashed because it attempted to access privacy - sensitive data without a usage description

I get the following error:
[access] This app has crashed because it attempted 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.
Do you know how to fix that?
These are set in the plist for your project. You can add/remove these by navigating to your target info inspector and expanding the "Custom iOS Target Properties" section. For example, one of the entries here in a project of mine is:
Privacy - Camera Usage Description
Allows user to capture a photo or video to upload to their family circle
You can see how this looks here:
You need to go to your Info.plist, add a new row and paste NSPhotoLibraryUsageDescription into the key column. Then in the value column give a description as to why you need to access the user's photo library. Repeat the same step with NSCameraUsageDescription if you intend to use the device's camera.

iOS 10 usage descriptions

iOS 10 requires you to have key in info.plist for each usage. When trying to submit app to iTunes I got an error.
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.
This app attempts to access privacy-sensitive data without a usage
description. The app's Info.plist must contain an
NSCameraUsageDescription key with a string value explaining to the
user how the app uses this data.
NSCameraUsageDescription is from card.io, but what could the NSPhotoLibraryUsageDescription be from? Is there a way to know?
I'm using xamarin but I guess that doesn't make a difference.
EDIT: I know that you need to add key to info.plist, what I don't know is why do I need it because I'm not using photo library anywhere
You need NSPhotoLibraryUsageDescription if you're implementing a share sheet that includes the option to save an image (which goes to the "Camera Roll"). You may have implemented (or be using) a data source that can produce data in .JPG, .PNG, .TIF form. Prior to iOS 10 your user would have been asked for access to the Photo Library (or Camera Roll). Now, if they do so without your app providing a usage description (like "This app needs to be able to share an image in your Camera Roll."), your app crashes.
Open your app's plist file and add the key NSPhotoLibraryUsageDescription like so:
Make sure you include a description as to why the app needs the photo library.
Maybe it's used in some framework.

App crashes with __CRASHING_DUE_TO_PRIVACY_VIOLATION__ when trying to access contacts

Upon updating to iOS 10, when trying to access the contacts through plugin cordova-plugin-contacts v2.2.0, the app exits with
__CRASHING_DUE_TO_PRIVACY_VIOLATION__
I don't know what other extra info i can provide right now, just let me know if i can be more specific. Thanx.
Maybe this is of some use: https://stackoverflow.com/a/39416858/592641, but i couldn't find a guide of how to specify those usage descriptions in cordova.
After creating an Xcode project and finding the Info.Plist file, you may try adding NSContactsUsageDescription key, which should accept a string value.
A complete list of Cocoa Keys
Hope that helps!
EDIT
A part from the doc: (which can help you understand why it is crashing)
Important: To protect user privacy, an iOS app linked on or after iOS
10.0, and which accesses the user’s contacts, must statically declare the intent to do so. Include the NSContactsUsageDescription key in
your app’s Info.plist file and provide a purpose string for this key.
If your app attempts to access the user’s contacts without a
corresponding purpose string, your app exits.
My app was missing NSFaceIDUsageDescription key
In short, the usage descriptions need to be specified inside *info.plist
That's no good for Cordova codebase since .plist files are not part of the repository. The simplest way I found to put them inside config.xml is this:
Install cordova-custom-config
Add the following inside config.xml:
.
<platform name="ios">
<config-file parent="NSContactsUsageDescription" target="*info.plist">
<string>Easily invite your friends</string>
</config-file>
</platform>
My Info.plist was missing NSPhotoLibraryAddUsageDescription. There are now TWO permissions associated with the photo library (starting iOS 11):
NSPhotoLibraryUsageDescription - to access the photo library
NSPhotoLibraryAddUsageDescription - write only permission to photo library
I had the first permission prior to iOS 11 when it was the only key needed to use the photo library. Apparently in iOS 11 they added the second and made it required to add photos to the library. So if you support iOS 10 but don't include the second key, you will crash on iOS 11.
All Keys are Here
For me, I was trying to request access to the microphone, but I hadn't defined the Privacy - Microphone Usage Description string.
Go into your Info.plist file, and scroll down to the values that start with Privacy. Make sure you add keys and string values for everything relevant to your app.
I got here with the same error using Kudan AR via Unity, and #NeverHelpless's answer was on target, except the fix was NSCameraUsageDescription (Add to Info.plist with a description string)
If you are clear the issue is when accessing Contacts, then follow instructions posted on above answers.
But if those didn't help you, you may want to read my related answer here on other possible solutions (if you are using Bluetooth on your app):
https://stackoverflow.com/a/60073667/457202

Resources