The background to locate for iOS - ios

We because of the functional requirements of the application of rules in 30 minutes to the server upload a local position, so I used in the project background, but submits to apple for review has been rejected,Then I shall, in accordance with the apple to add their prompt solution in the description of application of power loss of battery and so on, but still with the reason to refuse me, I really can't understand, what a great god met this kind of problem?
Reason:
2.16 Details
Your app declares support for location in the UIBackgroundModes key in your Info.plist file but does not declare any features that require persistent location. Apps that declare support for location in the UIBackgroundModes key in your Info.plist file must have features that require persistent location.
Next Steps
Please revise your app to include features that require the persistent use of real-time location updates while the app is in the background. Please also add the following battery use disclaimer in your Application Description:
"Continued use of GPS running in the background can dramatically decrease battery life."
If your app does not require persistent real-time location updates, please remove the "location" setting from the UIBackgroundModes key. 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.

Welcome to SO.
Your post is an unintelligible mess. You need to craft clear English language sentences that explain why you need background location services, and you also need to add language that warns the user that your app will reduce the user's battery life, as they explained to you.
It sounds to me like you are saying that your app needs to send updated location information to your server every 30 minutes even when it is running in the background.
If so, you need to explain that, and explain why you need to do that.
I gather that English is not your native language. You might need help from somebody who is fluent in both English and your language to translate your explanation so you can submit it to Apple.

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.

Is it possible to retrieve data from the Settings App?

Is it possible to access the data contained within the Battery view inside of the Settings App. More specifically, I am interested in the amount of time that has been spent on screen for each application.
I saw this app as well and was wondering how it works so I downloaded the app and the Moment app actually uses as notification to prompt you to screenshot the battery life each day which I assume it then uses OCR to read the data from the screenshot.
See attached images for the detailed app flow.
Not really, the information you want are from Private API's and unfortunately apple doesn't allow it.
But you can get some basic information and notifications related to battery settings like:
Battery State
Battery Percentage Level
Battery Monitoring - Enabled / Disabled
For more reference check this Link.

Something wrong with my iOS app's location service declaration

A few days ago when I uploaded a new version of my app to the App Store using Xcode, I received the following e-mail from iTunes Connect:
Subject: iTunes Connect: Your app AppName has one or more issues
Dear developer,
We have discovered one or more issues with your recent delivery for
"AppName".
The following are for your information only and do not require any
action:
We have detected that this build requires the use of standard location
services when running in the background. Apps requiring location
services will now display the following text disclaimer on the App
Store. 'This app may use your location even when it isn’t open, which
can decrease device battery life'.
Regards,
The App Store team
And the build that I uploaded cannot be selected for review submission on the iTunes Connect website.
How should I deal with this problem? Thanks.
I run into this issue long time ago, this is because, if your app is still use location service in the background, it maybe consume the battery.
1) If you want to always use the location service, you should set this, can let you pass the itunes verify:
you should in your Info.plist add NSLocationAlwaysUsageDescription permission, and set the value, why you want to always use the location service.
2) If you just need when user using app this duration to use location service. You should NSLocationWhenInUseUsageDescription instead of NSLocationAlwaysUsageDescription permission, and you should also set the description why you want to use the permission.
Apple guidelines *
If your app requires location usage even in the background mode, In bottom of the app description and iTunesConnect application page you have to put this text
"This app may use your location even when it isn’t open, which can decrease device battery life"
It is important to put this disclaimer so that if user downloads your application he should be aware that location services will be active for the app even when the application is not in the use.
You don't have to put another build, just update the description with this disclaimer and submit for review again. It will get re-reviewed and, if all terms and conditions are valid, it will be approved.
Since Apple services for new application upload is not active from 23rd Dec to 27th Dec due to yearly Christmas holiday, so you should try to submit for review after it.
Let me know if you have any issues.
While going through the same issue, I found that
Capabilities -> Background Modes -> Location updates
were enabled for my app.
Please deselect this, if your app does not require location updates in background.
This is not a big problem actually. Apple reviewer already said you "do not require any action" he / she only suggest you it is more appropriate show a warning text (it is appear when you request to use location service within UIAlertView) like this message 'This app may use your location even when it isn’t open, which can decrease device battery life'.
You can add descriptive string in .plist file.
Probably you forgot to add NSLocationWhenInUseUsageDescription or NSLocationAlwaysUsageDescription in plist or you didn't add background mode in capabilities of the project.
The problem is with your string message you are displaying. i was also once stucked in this kind of issue i was using app name like "Burn you phone". So by changing the message string on location authorization will do the trick.
I had the same problem and contacted iTunes Connect about it. Below are excerpts from their responses so far:
I do understand your concerns about continuing to receive notices with
every update or build. I can confirm this is working as expected.
...
There are some emails that are system-generated by iTunes Connect and
there is not a way to disable them at this time. If you provide us
feedback we will be more than glad to provide it to the appropriate
team for future improvements.
...
You can definitely try adding the app description and see if this will
resolve the email notifications.
However, we can not assure you that this will cancel the email
notifications.
Just wanted to demonstrate their stellar customer support and exemplary knowledge of their own product...
However, I haven't yet confirmed whether putting the text in the description field will silence the email.
The other responses here mention the privacy usage descriptions in Info.plist, but this email is not directly related to this issue. Anyways, if you neglect to include those, your app will just crash when you try to access location services (unless permission had already been given in a pre-iOS 10 version of your app).

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

Require user to be in particular area for app to load

I have been looking into getting the user's location and then verifying they are in a particular building, and then loading the app. I have been experimenting with CoreLocation but cannot find any cases where this location verification is true. I was thinking the easiest way would be an if/else statement but I need the location to do that. I want this to be compatible with as many iOS devices as possible, so backwards compatibility is something I am interested in too.
This is simple to do, there are tons of tutorial that'll show you how to do this. The gist of it is:
Register app to use location in the background.
Ask permission to use location all the time.
Create the region that you want to use to wake the app up.
Start monitoring for location changes to that region.
The app will relaunch when the user enters that region and calls appDidFinishLaunching, then you can do your thing.

Resources