Location Background Mode Always or WhenInUse - ios

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.

Related

Apple disallowing background location tracking which is critical to business use case

We have an app that tracks riders in the field and as per their current location and some other parameters assign them deliveries. For this, even when the user is not currently using the app, background mode or device locked, we need to keep track of their location after every x seconds.
Now, we have explained the complete business use case to Apple but they keep coming back with the same response:
Thank you for information. We still need a demo video that shows a
“Background Location” feature (Such as: turn-by-turn navigation,
bread-crumbing) when the app runs in the background.
We still do not see a “Background Location” feature (Such as:
turn-by-turn navigation, bread-crumbing) within your app in the demo
video your provided. If the app does not have this feature, please
kindly use the foreground location instead. please remove the
“location” setting from the UIBackgroundModes key if your app does not
require persistent real-time location updates. You may wish to use the
significant-change location service or the region monitoring location
service if persistent real-time location updates are not required for
your app features.
I wonder how does Uber and other ride sharing/location based apps go around this app for their drivers
You haven't really asked a question above (likely why someone downvoted). You've mostly just posted a complaint about Apple's review process. You've not explained why it's critical to get it every few seconds. And you haven't mentioned why Apple's suggestions don't work/aren't good enough.
Here are some general points around the area you have mentioned that should be useful
Background location:
If you want to allow your app users to close your app, you can use "significant-change location service" to allow your app to detect when the device has moved a lot, in a much more battery efficient way. You get ~10 seconds to ping a server and restart the request for the next time. Apple mentioned this in their response to you, please check it out: https://developer.apple.com/library/archive/documentation/UserExperience/Conceptual/LocationAwarenessPG/CoreLocation/CoreLocation.html
"I wonder how does Uber and other ride sharing/location":
They don't do what you are trying to do first of all, they encourage their drivers to keep the app open at all times for optimal performance. Again Apple mentioned this in their response. Your app is not providing any use to the app user while in the background and tracking location. So either keep the app open and track location (How to prevent screen lock on my application with swift on iOS) or, rely on significant change location events in the background
Again as Apple said in their response, if 1 or 2 above doesn't address your needs (likely they do), you need to implement a feature such as turn by turn directions in the background, in order to justify why you need this data. Users also need the ability to turn this off, so that it can't be abused by the developers.
Apple doesn't allow apps to just track whatever they want due to privacy issues. There is no way to get around this, you'll have to do one of the above.

Does "allow only when the app is active" also include the background?

I have to get the locations of my user even when the app is in the background. So my question is if my user only allows the application to get the locations when the app is active, does this "active" mean also active in the background?
iOS apps can support one of two levels of location access.
While using the app
The app can access the device’s location when the app is in use. This is also known as “when-in-use authorization.”
Always
The app can access the device’s location either when app is in use or in the background.
so the answer of your question is NO, Location access is not active when app is in background with While using the app level.

iOS location permission after app reinstall

I’m using Crashlytics for internal application tests and noticed one interesting thing. I’m using geolocation in my app and asking for permissions from a user. When customer install app for first time he sees default Apple’s geolocation permissions asking pop up. And everything work fine.
But, if user will remove app from phone and install it again... in this case, when I’m asking for permissions, pop up just won’t appear BUT geolocation is WORKING. How? Is this some sort of new feature or iOS issue? I were testing with iOS 11.0.3. I haven’t found anything in documentation, and haven’t seen this behavior in previous iOS versions. Looks like iOS just memorize the app and automatically enables geolocation when I’m asking for user permissions instead of showing pop up.
Maybe someone has answer for this?
it is possible that there could be a mistake in your code pattern while checking authorization status, the behavior you are seeing is likely due to iOS caching location permissions for apps.
In your code, make sure that you check authorization status (via the authorizationStatus() method), and continue with requesting location authorization when the current status is .notDetermined (kCLAuthorizationStatusNotDetermined)
iOS does cache authorization status for apps as well. If you would like to reset your location permissions for testing purposes, you can set your location privacy settings to the factory default: go to Settings > General > Reset and tap Reset Location & Privacy. When your location and privacy settings are reset, apps will stop using your location until you grant them permission.
Unfortunately there is no developer control over this.
Caching of permissions for apps is in an ever evolving stage, where we are trying to find the best user experience, so you may have noticed some changes lately. Also, there will be a grace period where the app uninstall to reinstall time might be making a difference.
If your observations of apps that behave like you expected are recent (on the same version of iOS that you have observed your app behave differently), and the uninstall/reinstall time difference is immediate (like how you probably test your app), please let me know which apps, and I will see if I can dig some information.

Location service in iOS

I get a pop-up saying that so and so app is continuously tracking your location. How do I prevent this from appearing on screen? When the user is using the app for the first time, I have no problem with this message. But I get it later on after some days. How do I prevent it?
You cannot prevent it. It is part of the privacy and location functionality in iOS. It reminds the user that they have granted your app permission to use location in the background and that your app has been doing so. It gives the user an opportunity to change their mind about your apps location permissions

kCLAuthorizationStatusRestricted is showing up for one of my apps but not another on the same device

I have an app i'm maintaining which recently stopped reporting users locations. This is happening on many devices where it was previously working. On my device I have determined that the auth status of CLLocationManager is kCLAuthorizationStatusRestricted. This stops the app from prompting for user permission.
I have no restrictions set around core locations and another app of mine running the exact same helper class to manage location works fine on the same device. It prompts for user permission as it should.
Does anyone know anything that would cause kCLAuthorizationStatusRestricted to show up besides restrictions?
In the Settings app (in iOS 6) look under General, then Restrictions. If Restrictions is enabled, then scroll way down to Privacy section. This is where Restrictions are set for Location Services.
This is a different set of Privacy restrictions from the Privacy section that is on the first screen that can be locked with a passcode.

Resources