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.
Related
I'm developing an iOS app using Expo. My app needs Location permission in order for geofencing to work when the app is not in use. I've followed Expo's documentation for Location Permission and provided NSLocationWhenInUseUsageDescription, NSLocationAlwaysAndWhenInUseUsageDescription, and NSLocationAlwaysUsageDescription descriptions in my app.json. But when my app prompts the user for location permissions the options given are While Using App, Allow Once, or Don't Allow.
How can I get my app to prompt for Always Allow?
In iOS 13, Apple changed the way that "Always allow" location permissions work.
The Always Allow option, which grants an app “background” location access, has been removed from the initial location permissions prompt. Instead, users can select Keep Only While Using (aka “foreground” permission) or select a new option,Allow Once. So how does an app then get upgraded to “background” location permission? If the user continues to use the app, iOS 13 will now automatically and periodically prompt to upgrade location permissions from While Using to Always Allow.
I'm looking to get locations that are already significant to a user without having to rebuild a list of their frequent locations. I noticed that in the phone's settings there's "Significant Locations" in
Settings > Privacy > Location Services > System Services > Significant
Locations
I'm not sure if it's accessible using Swift. Is it possible to get these locations for use in my app?
No, it's not possible to get the places a user has been before your app was installed. You can only get the locations that the user has been to after your app is installed. To do that use a CLLocationManager with "Visits" by calling -startMonitoringVisits and waiting until the user stops somewhere. You'll need to get explicit authorization from the user to receive Visits information.
Documentation: Using the Visits Location Service
Note: The "Significant Locations" in the Settings app is different from Core Location's Significant Location Change Monitoring
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.
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
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