Is it possible to define NSLocationWhenInUseUsageDescription within a Framework? - ios

I have developed a Framework which at some point will try to request the device's location. As I understand it, every App which includes this Framework will have to add a NSLocationWhenInUseUsageDescription to its own Info.plist in order to make location usage possible from within the Framework.
Is there a way to provide a NSLocationWhenInUseUsageDescription already inside the Framework so I don't have to rely on the App to define it?
Adding is to the Framework's Info.plist doesn't work. Modifying the App's Info.plist at runtime is also not possible.

Not possible.
The info.plist is present in your Apps Bundle, which is READ-ONLY. This makes it impossible to modify it at runtime.
This makes a lot of sense too because Apple doesn't want Apps to request X permissions when the app is in review and switch to Y once the app is live.
Not letting Frameworks directly request permissions also makes sense. Because you want the app to be aware what permissions related to users sensitive data, a third party piece of code needs before you include it in your code.
All iOS frameworks include required permissions in a readMe file or in such a relevant document along with the framework.

It's not possible as i know... You will have to explain that in order to use your framework, the developer must include the NSLocationWhenInUseUsageDescription tag.

Related

Xamarin iOS project Info.plist issues during submission on App Store

I am developing project which use the following permissions in Info.plist: NSCameraUsageDescription,
NSPhotoLibraryUsageDescription, NSMicrophoneUsageDescription, NSPhotoLibraryAddUsageDescription, NSCalendarsUsageDescription. App can browse photos library or take a picture. After the deployment process for submission on App Store I get the info:
The app's Info.plist file should contain a NSLocationAlwaysUsageDescription key with a user-facing purpose string explaining clearly and completely why your app needs the data.
The app's Info.plist file should contain a NSLocationWhenInUseUsageDescription key with a user-facing purpose string explaining clearly and completely why your app needs the data.
In my app I don't use or ask user for location permission. Moreover I use the NuGet packages: Xamarin.Essentials, Forms, Plugin.Permissions. How can I workaround this issue with location permissions to avoid placing this ?
There is nothing that you can do to workaround the problem aside from removing plugins.
And there are no reasons to do something like that as the end-user won't see any difference unless you ask for the location in the app's code. Info.plist is not visible to the end user in any way including through the app listing.

"Missing Purpose String in Info.plist File" not actually missing

Attached is what I get from Apple after uploading to the App Store Connect, even though all of these are included in my info.plist. I have tried nearly 10 times to change the name of my string ranging from long strings (e.g. We get the bluetooth in order to connect with certain DJI models that require bluetooth to get telemetry and other data from the drone.) to short strings (e.g. We display the user's location on Mapview.)
All other questions I have seen claim the simple solution is to include the string, which I'm already doing! Does this have something to do with DJI's sdk? I would think just including this in MY info.plist would be enough. The main issue seems to be with the bluetooth permissions as another app I am trying to upload returns the same issue.
"Dear Developer,
We identified one or more issues with a recent delivery for your app,
"DJI Swift Demo". Please correct the following issues, then upload
again.
Missing Purpose String in Info.plist - Your app's code references one
or more APIs that access sensitive user data. The app's Info.plist
file should contain a NSBluetoothPeripheralUsageDescription key with a
user-facing purpose string explaining clearly and completely why your
app needs the data. Starting Spring 2019, all apps submitted to the
App Store that access user data will be required to include a purpose
string. If you're using external libraries or SDKs, they may reference
APIs that require a purpose string. While your app might not use these
APIs, a purpose string is still required. You can contact the
developer of the library or SDK and request they release a version of
their code that doesn't contain the APIs. Learn more
(https://developer.apple.com/documentation/uikit/core_app/protecting_the_user_s_privacy).
Though you are not required to fix the following issues, we wanted to
make you aware of them:
Missing Purpose String in Info.plist - Your app's code references one
or more APIs that access sensitive user data. The app's Info.plist
file should contain a NSLocationWhenInUseUsageDescription key with a
user-facing purpose string explaining clearly and completely why your
app needs the data. Starting Spring 2019, all apps submitted to the
App Store that access user data will be required to include a purpose
string. If you're using external libraries or SDKs, they may reference
APIs that require a purpose string. While your app might not use these
APIs, a purpose string is still required. You can contact the
developer of the library or SDK and request they release a version of
their code that doesn't contain the APIs. Learn more
(https://developer.apple.com/documentation/uikit/core_app/protecting_the_user_s_privacy)."
Instead of verifying the plist information in XCode, please look into the plist inside ipa.
Please follow the below steps to verify plist inside ipa.
Let say, your ipa file is Demo.ipa
Copy the Demo.ipa to DemoBkup.ipa
Rename it to DemoBkup.zip
Extract the zip file. (Double click the zip file)
The Extracted file will contain "Payload" folder.Get into Payload folder.
You will find the Demo package. Right click and tap "Show Package contents"
Search for your Info.plist.
Validate all the information you gave in XCode is present in this plist.
Change your info.plist keys with the keys Privacy - Bluetooth Peripheral Usage Description, Privacy - Location When In Use Usage Description. Check the given screenshot for reference:
Do check the plist file referenced by the scheme you are building. I think the plist file you are making change is not the same referenced by the scheme from what you are building the ipa file to submit to App Store.

Xcode iOS remove framework's permission request

I developed a game for iOS using Unity. I use a lot of frameworks and libraries (especially for serving ads). But my app is always requesting a location permission: NSLocationWhenInUseUsageDescription. I don't even know which framework needs this permission but I want to disable this requests. Is there a possibility to do that without removing a framework?
Inside Xcode, Go to your info.plist file. there should be a permission mentioned there.
"Privacy - Location Always and When In Use Usage Description"
Click on it and then click "-". Like this
It will remove the permission asked on runtime but if it's required because of any framework attached then it may cause some issues.
Let me know if it helps

Error Appstore connect : Missing Purpose String in Info.plist File (NSBluetoothPeripheralUsageDescription)

Dear Developer,
We identified one or more issues with a recent delivery for your app,
. Please correct the following issues, then upload again.
Missing Purpose String in Info.plist File - Your app's code references
one or more APIs that access sensitive user data. The app's Info.plist
file should contain a NSBluetoothPeripheralUsageDescription key with a
user-facing purpose string explaining clearly and completely why your
app needs the data. Starting Spring 2019, all apps submitted to the
App Store that access user data will be required to include a purpose
string.If you're using external libraries or SDKs, they may reference
APIs that require a purpose string. While your app might not use these
APIs, a purpose string is still required. You can contact the
developer of the library or SDK and request they release a version of
their code that doesn't contain the APIs. Learn more
(https://developer.apple.com/documentation/uikit/core_app/protecting_the_user_s_privacy).
Best regards,
The App Store Team
Actually, I am not trying to use to access bluetooth. But somehow App Store reject my app like this.
If you added CoreBluetooth.framework in linked libraries and frameworks section in Build phases , remove it.
Also, check if any third party libraries that you are using in the project uses bluetooth. Check if any files import CoreBluetooth.framework
Are you using advertising frameworks ?
Ad frameworks sometime use bluetooth information.

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

Resources