Location Services permission is empty - ios

I'm using Location Manager to track regions. On one device my app behaves strange. Location permission was granted to be used Always, but Location Manager returns 0,0 as current coordinate and when I go to the Settings / Privacy / Location Services / App - neither Never or Always are selected.
This happens on iOS 11.0.2
I've set plist key (NSLocationAlwaysUsageDescription) and use only requestAlwaysAuthorization because it's required to region monitoring.
One important thing - Google Maps and Apple Maps use current location normally.

As Brad Jensen explains in the WWDC talk, Apple has decided that forcing the user to give the app “Always” location access is a bad user experience:
https://developer.apple.com/videos/play/wwdc2017/713/
So when you build your app using the iOS 11 SDK, you are now required to provide an NSLocationWhenInUseUsageDescription key in all cases (if you use location at all). For “Always” access, you can additionally provide a second key, which is now called NSLocationAlwaysAndWhenInUseUsageDescription.

Related

Location Background Mode Always or WhenInUse

I have two apps built that use your location similar to a run tracking app where I use the location in the background but only when you are actively tracking a run. This works in iOS 11 after only requesting WhenInUse authorization and you get the top blue bar when you leave the app. Both are in the app store but in my most recent submission I keep getting rejected with the following response:
Regarding 5.1.5, the current modal alert available to the user requests permission to access the Foreground Location. However, your app does not request and obtain the user's consent prior to accessing their background location data, which is not allowed on the App Store.
Is this something new and they just haven't noticed before? I also checked Google Maps and Strava and they both use my location when I'm actively using it even when they are in WhenInUse mode.
I would prefer to use only WhenInUse mode as I think it more clearly conveys to the user what the app is doing. We never use your location when the app isn't recording a run.
If you can link to Apple documentation about this situation it would help even more.

Are location permissions somehow auto included in Adobe AIR for iOS?

In my application I include a 3rd party SDK which has the capability of asking for background location permissions. However I do not want this feature or the permissions popup in my app. From what I can tell this should be as simple as not including the NSLocationAlwaysUsageDescription in my plist.
As per Apple's documentation on NSLocationAlwaysUsageDescription:
This key is required when you use the requestAlwaysAuthorization method of the CLLocationManager class to request authorization for location services. If this key is not present and you call the requestAlwaysAuthorization method, the system ignores your request and prevents your app from using location services.
https://developer.apple.com/library/content/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html#//apple_ref/doc/uid/TP40009251-SW18
However the app clearly is capable of calling for permissions as the popup still shows when utilizing the SDK. When using the SDK in a non-AIR test app I do not have this issue.
Ideally I am looking to prevent these popups as this SDK is integral to the product. How can I tell AIR not to include this capability?
No, location permissions are not auto included with the AIR SDK.
The NSLocationAlwaysUsageDescription key is a requirement, it is not the element that initiates the location permission.
This is also a new requirement, so for older iOS versions this does not apply.
It sounds like your third party SDK is the issue, perhaps contact the developers and enquire with them.

Overriding iOS Settings UI - Apple rules

As in many apps, also in my app I have a "Settings" view.
I would like to add an item composed by text + UISwitch in order to give user possibility to change the "location services" permissions: when switch is enabled "allow location services: always", when is disabled "allow location services: never".
Question is: could this a reason for an Apple App Rejection?
I read all guidelines but I can't find an answer to my question.
Links
Review rejections.
Review guidelines.
UI Tips.
Regardless of app store review, what you're thinking of doing isn't technically possible. Your app can only request location permissions, it can't then tell the system that it doesn't need them any more.
For the user to amend location permissions they have to open the iOS settings app and go to the page for your app. You can provide a link from within your app to do this, using the UIApplicationOpenSettingsURLString constant to build and open a URL.
I don't know your code so I'll try to help you writing a few lines to follow to understand Apple reject.
So the first thing you need to do is to add one or both of the following keys to your Info.plist file:
NSLocationWhenInUseUsageDescription
NSLocationAlwaysUsageDescription
Next you need to request authorization for the corresponding location method, WhenInUse or Background. Use one of these calls:
requestWhenInUseAuthorization
requestAlwaysAuthorization
Location types that you need Always authorization to use:
Significant Location Change
Boundary Crossing (Geofences)
Background Location Updates (e.g. Fitness, Navigation apps) iBeacons
Visited Locations (iOS 8+)
Deferred Location Updates

Application settings does not contain location service

I have an application which requires location access. If location service under settings->privacy in ON and I installed my application then location service will be available under my app settings even my app is listed under location services list. But when location service under settings->privacy is OFF and I installed my app, it will show the alert to turn ON location service in settings->privacy but my app is not listed under location services list, even in my app settings location service is not available to turn it ON/OFF.
Please let me know, if there any way to get location service in app settings or this is a bug with apple itself.
Thanks in advance.
After so many times of reading your question, I finally got what you're trying to say. So I did the following:
Turned off the Location Services in SETTINGS.
Result: Of course the list of the apps that uses location services became hidden.
Installed a certain project that uses Location Services.
Result: The popup - "Turn On Location Services to Allow "App_Name" to Determine Your Location". It has two buttons: SETTINGS and CANCEL. I clicked the SETTINGS button.
After being redirected to the Settings from Step 2, I turned on Location Services.
Result: The settings listed again the apps that use Location Services. Including my newly installed project. I can turn on the location services in my app settings, or restart my app to produce a pop up that it needs me to allow it to access my location.
So, I'm guessing you need to add these keys to your info.plist.
NSLocationAlwaysUsageDescription - value: "APP_NAME" needs your location"
and
NSLocationWhenInUseUsageDescription - value: "APP_NAME" needs your location"
I've written a quite 'nasty' tutorial for MKMapView Implementing Programmatically. It includes the info.plist that I mentioned and catching the current location services state.

Can i use both NSLocationWhenInUseUsageDescription & NSLocationAlwaysUsageDescription?

One of the frameworks I used (Indoo.rs SDK,for bluetooth location detection) was developed to work with NSLocationWhenInUseUsageDescription in the plist file. I am also using Core Location manager which is configured to work with NSLocationAlwaysUsageDescription.
Can I use both in my .plist? I am not sure how to proceed with this when there are two types of hardware (bluetooth & GPS/WIFI/Celltowers) used for location services.
if you provide two options in your plist file, you will see 3 entries for location in app settings: Always, When In Use and Never, if you provide NSLocationAlwaysUsageDescription only in plist, you will see two entries in the settings: Always & Never and if you provide NSLocationWhenInUseUsageDescription only in plist, you will see two entries in the settings: When In Use & Never
It isn't to do with the hardware that you are using - it is to do with whether you want to use location servers only when your app is running in the foreground (when in use authorisation) or also when your app is in the background (always authorisation).
You should then request the appropriate level of access. "Always" authorisation includes "when in use" authorisation, so if you prompt the user for "always" authorisation then they won't be prompted if the framework requests "when in use" authorisation.
If, however, the framework requests "when in use" before your code requests "always" then the user will see two requests and you will need to set both keys - From a user experience point of view you should avoid this.
Basically you can use only the NSLocationAlwaysUsageDescription in your .plist because if you ask for permission to use the user's location always, you can of course use it also while the app is in use.
These are just settings. Think of how your app is going to work and choose the appropriate permission. "Always permission" means that your app can update its location even if not running (which also drains battery much faster and leaves the location icon on the status bar on all the time and is far more common to get turned off by the user manually later). So choose what your app really needs.
Having the two options both listed gives the user more control over its privacy. The user can decide to only allow locations when the app is open but deny background locations.
NSLocationAlwaysUsageDescription is deprecated.
Apple reference

Resources