Xcode iOS remove framework's permission request - ios

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

Related

iOS: How to remove the reference to API that is not in use?

I have submitted ionic app to App store but it asks me to add reference to the info.plist file. Following is the error.
ITMS-90683: 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 NSBluetoothAlwaysUsageDescription 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 are 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.
But my project doesn't use Bluetooth.
How to get rid of this error and how to remove api reference that is not in use. I am new to xcode and iOS.
Check if any of your external libraries are using Bluetooth. Search for "NSBluetoothAlwaysUsageDescription" in the whole project, normally if a library uses Bluetooth, you will find it in its Info.plist
If you have to use that library, just add that purpose string to the Info.plist of the main project to make Apple happy.
I have the same problem with an app and added the NSBluetoothAlwaysUsageDescription; Apple has subsequently rejected it saying they could not identify any Bluetooth functionality in the app and to remove the permission key. So now I'm stuck.
In my case (an Ionic 3 app), despite not explicitly including cordova.plugins.diagnostic, its bluetooth dependency was being brought into my iOS build and resulting in the same warning on submission to apple.
To correct I first added this line to config.xml (which basically says we don't want to bring in any of the diagnostic modules):
<preference name="cordova.plugins.diagnostic.modules" value="" />
Then ran the following to add it to my project:
ionic cordova plugin add cordova.plugins.diagnostic
And after removing and re-adding the ios platform the generated Xcode project no longer had the bluetooth dependency and I was able to submit to Apple without any problems.

React Native app asks iOS location permissions on first launch, but 0 references to geo/location code anywhere inside

So I have a React Native app, and when testing in iOS, on first launch it always asks for location while in use (within 1 second of opening). ie. "Allow XXX to access your location while you are using the app?" permission dialog.
I am using react-native-permissions for other stuff, but I've searched and searched my code and have 0 references to "geolocation","location","navigator",etc. Basically there no location code or geolocation code anywhere to be found.
Looking for help on how to diagnose this crazy issue. In my NPM modules, again nothing crazy there either that would depend on location. I've even deleted the "NSLocationWhenInUseUsageDescription" from info.plist and app still launches, doesn't crash and never prompts location dialog!
(This is on iOS 11.3)
Looking for advice.
Thanks
Check your Info.plist, you probably have either of these keys, or both:
NSLocationAlwaysAndWhenInUseUsageDescription
NSLocationAlwaysUsageDescription
As a result iOS will prompt for location access as soon as you launch your app.

App rejected: Missing Info.plist key "NSBluetoothPeripheralUsageDescription" but framework is not present

I have a Cordova app that runs in iOS phones. I'm trying to send an update of this app to App Store, but it is being rejected. Firstly it was rejected because the info.plist contained a line with the key NSBluetoothPeripheralUsageDescription and this feature is never used in my app. To solve this problem I removed this line from info.plist and the respective framework from Linked Frameworks and Libraries in xCode (the framework CoreBluetooth.framework and the line NSBluetoothPeripheralUsageDescription was added by Cordova Diagnostic Plugin), as can be seen in the image below:
However now I'm receiving a e-mail from iTunes Connect saying this:
Missing Info.plist key - This app attempts to access privacy-sensitive
data without a usage description. The app's Info.plist must contain an
NSBluetoothPeripheralUsageDescription key with a string value
explaining to the user how the app uses this data.
But I removed the CoreBluetooth.framework from the xCode project...
My question is: I need to remove this framework from another place? Are some other framework able to use bluetooth causing this problem?
Thanks for help.
Open Info Plist file and press on + sign add new key in info.plist of your project and add this NSBluetoothPeripheralUsageDescription and write value "Explain the reasons for bluetooth"
Check Screen shot below
It appears that you cannot have a generic text string like:
We need access to your bluetooth connection.
I had something like this and got rejected. When I had a more detailed description like:
We need access to your bluetooth connection to upload data from your
device for crash reports.
I was approved.
The descriptions are mandatory for any content you or any frameworks you link against attempt to access. The errors are generated upon an attempt to access the content if a usage description was not supplied, so if you're getting those errors your app must be requesting them. You should discover why your app or its frameworks require these and add appropriate usage descriptions to your app's info.plist.
Or more ideally, if you don't need access, see if there's a way to not request it (or use frameworks that do unnecessarily).
For time being you can add the following descriptions in your info.plist and submit your app (in case of urgent app update)
<key>NSCalendarsUsageDescription</key>
<string>Explain the reasons for accessing...</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Explain the reasons for accessing...</string>
<key>NSBluetoothPeripheralUsageDescription</key>
<string>Explain the reasons for accessing...</string>
Just open your info.plist and add the code above accordingly.
Try to add below in your plist. It solve my problem.
<config-file parent="NSPhotoLibraryUsageDescription" platform="ios" target="*-Info.plist">
<string>YourAppName would like to store a photo.</string>
</config-file>
I found this thread because I had the same problem.
My experience was that I had installed a Bluetooth package with cordova, but, the experiment fail, and with the new copiles has this issue.
I checked the package.json, the package-lock.json and that I removed all the refences to my code. But, still falling.
Then I checked the pods bundle and found the Bluetooth bundle, but still failing.
I remove and add the platform ios and still falling.
Then I check the project and in the plugins folder I have the Bluetooth plugins folder. Removed, Compiled and works again.
I hope to help you.

Is it possible to define NSLocationWhenInUseUsageDescription within a Framework?

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.

IOS App Submission Routing App

I am trying to submit my app for review in Itunes Connect, but when I try to submit it I get an error:
To configure this app as an IOS routing app, upload a routing app
coverage file on the app's Version page in My Apps on iTunes Connect.
To configure your app as an IOS routing app, the app's Info.plist must
contain the MKDirectionsApplicationSupportedModes key.
So in my project, in the Capabilities, the Maps is turned off. I do have the MapKit.framework in my project, as I do utilize the map, however I do not ever show routing information nor provide it in my app. Is the fact that this framework in my project causing this ITunes Connect error, and if so, how do I go about fixing it. And by fixing it, I want it to turn off routing.
My app is not made to provide routing information, nor do I want to set it as an iOS routing app.
Any help would be appreciated.
I am using XCode 6.
I figured it out. In my info plist there was a document type name of MKDirectionsRequest. Removing that solved the problem.
From the apple docs
(To use the features of the Map Kit framework, you must turn on the
Maps capability in your Xcode project.)
above the entire paragraph.(https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/LocationAwarenessPG/Introduction/Introduction.html#//apple_ref/doc/uid/TP40009497)
Location-based information consists of two pieces: location services
and maps. Location services are provided by the Core Location
framework, which defines Objective-C interfaces for obtaining
information about the user’s location and heading (the direction in
which a device is pointing). Maps are provided by the Map Kit
framework, which supports both the display and annotation of maps
similar to those found in the Maps app. (To use the features of the
Map Kit framework, you must turn on the Maps capability in your Xcode
project.) Location services and maps are available on both iOS and OS
X.
Not sure but maybe you only need to turn on mapkit
In my info.plist I had to delete two entries:
1) the document you referenced above - MKDirectionsRequest
and
2) MKDirectionsApplicationSupportedModes - MKDirectionsModeCar which is called "Maps routing app supported modes"
I just faced this exact issue last week.
I had accidentally turned on Map capabilities and turned it off later. Like your case, this didn't fix the issue.
I believe what fixed it was removing MapKit from here.
I was trying other things at the time so try this and if this isn't it then I'll see if something else I changed fix this.

Resources