Apple rejected the app saying app uses a background mode - ios

The app which I submitted does not have any background location mode. I am not having "Required background modes" field in my plist.
I even checked the device capabilities, Background modes is off.
From Apple as follows,
we found that your app uses a background mode but does not include the following battery use disclaimer in your Application Description:
"Continued use of GPS running in the background can dramatically decrease battery life."
Can any one please help me how to find out whether my app is using background location mode or not ?

This link will tell you about Background fetch.
If you really need the app to constantly monitor the location of the user's device then you should put the disclaimer in your app's description.

Remove CoreLocation Library from your libraries/frameworks folder and resubmit.

Related

Getting device location when the app is in foreground, background or terminated state in IOS

I am trying to get the device's location after a fixed interval, say 15mins, no matter if the application is in foreground, background or terminated state.
The application we are developing is the critical alert system for which we need to fetch user's location at a particular time interval even when the app is terminated. I have used BGProccessingTask for that purpose with earliestBeginDate = 3600. Even after specifying it for an hour, it begins the task anytime like 8-9 hours later or sometimes more.
Description says - 'Setting this property does not guarantee that the task will begin at the specified date'.
Would appreciate it if someone could help.
Also, is there any other solution for this?
Go to "Signing & Capabilities"
Under "Background Modes" add "Location Updates"
Make sure you add to the info.plist file all the relevant Usage-description keys (NSLocationAlwaysAndWhenInUseUsageDescription, NSLocationAlwaysUsageDescription, NSLocationWhenInUseUsageDescription)
Be ready that the next time you submit, you will be asked by the Apple Review team why is your app using this background mode

App in background swift iOS

i have a big problem. I am working on an app about accessibility. The app should work through the iPhone microphone to take over sounds from the environment (indoor) and compare them in real time with sounds in the app database (recorded from users previously). If sounds match, the user will be warned by the app through a notification. So... firstly, the app should listen sounds working in background, but after some minutes, iOS closes the app in background automatically. IS THERE SOME SOLUTIONS FOR THIS PROBLEM? TO ALLOW THE APP BE OPENED AND WORKING?
Secondly, do you know in which way is possible compare sounds recorded with sounds listened by microphone in real time?
Really really thank you. 🙏🏻
Regarding the problem that your app is automatically closed, it seems that something was not configured properly in your project.
When the UIBackgroundModes key contains the audio value, the system’s
media frameworks automatically prevent the corresponding app from
being suspended when it moves to the background.
Make sure that you have enabled the "Audio, AirPlay and Picture in Picture" background mode in your project.
Fore the first question:
Because your app will be recording the audio while in background, you can:
set UIBackgroundModes key in your app’s Info.plist file to audio.
It should keep your app alive when you press Home button. See the Declaring Your App’s Supported Background Tasks section
At some point, iOS can kill your app due to some conditions, but
eventually it would restart your app later.
And be careful with this, you might have to deal with Apple Review team to prove that your app is not doing something harm to user privacy. Otherwise, they wouldn't let it go live.
For the second question:
I think you can use some AI/Machine Learning service out there to do so. It's much more accurate and faster than building it your own.

iOS background bluetooth discovery stops on display off

We are trying to monitor a Bluetooth LE device as a background task on iOS.
Everything is working fine, except the background task runs only when the display is turned on.
This is not what we want, because we want background monitoring while the phone is not in use.
We are searching for information about why and how apple does this, but there is nothing to be found.
Does anybody know if it's possible to keep running background tasks when the display is turned off?
Yes, this is possible - see the "Background Execution Modes" section of the Core Bluetooth Programming Guide. Your app must declare its background mode in its info.plist file, and your app will only be woken on a BTLE event. Also, note that when you call scanForPeripheralsWithServices:, you must specify a list of services in which you are interested - if you use the default of nil your app will never be woken.

UIAutomation : Change location when the app is in background

I am working on UIAutomation. I need to change the location when the app is in background. I have tried following line of code:
var target = UIATarget.localTarget();
UIATarget.localTarget().deactivateAppForDuration(30);
target.setLocation({longitude:77.50, latitude:12.50});
but target.setLocation is not getting called until the app comes to foreground.
Could any one please tell me how I can change the location when the app is in background.
Unfortunately UIAutomation can only automate the application it's attached to. When the application is not "active", it has nothing to talk to. Using lockForDuration, deactivateAppForDuration , etc blocks while it relinquishes control to the system, making your app inactive. While the application is in that state UIAutomation can't send it any more messages.
I would recommend filing a radar asking for the ability to set the location while the application is inactive.
When I ran into a similar problem in the past I had to use AppleScript to change the location of the simulator to get the effect I needed.
You have since updated your comments indicating you are testing a navigation application. Well! That's a little different. If you do not ACTUALLY require UIAutomation and were only trying to use it as a way to set the location:
Xcode does allow you to simulate a route using GPX files, and this CAN be used with Instruments.
Find an appropriate GPX file, preferably one that is a track.
Go to the scheme for your project. In the Run action, go to the "Options" tab. Check "Allow Location Simulation" and use the drop down list to add your GPX.
Run your application from Xcode.
...
Profit!
I think you can use update part in background as service. Though i am newcomer in this world. You can try this. Thanks
if you want your app to execute methods in background, you have to enable "background mode" in your capabilities tab of your app. you have to choose a mode, for example "location updates". but be careful: apple has restrictions of what kind of apps are allowed to run in background. the "location updates" mode are only allowed for apps like navigation apps. see the app store guidelines for details.
if you dont set the "background mode" to yes, your app has 5 seconds to finish executing tasks after turning to background and then all tasks will be stopped and never called until your comes to foreground again.
Refer the http://code.tutsplus.com/tutorials/ios-7-sdk-working-with-background-fetch--mobile-20520 for the Background fetch. I hope this helps you.

Application does not work properly in background without Xcode

I'm building an activity analyzer application for iPhone and I use iOS 7. In order to do these i use CMMotionManager and I access accelerometer data.After this I write the datum to database. My application has to work also in background and I used queues, GCD, blocks and other such things in my code to do this properly. Problem is, all of these are working properly when iPhone is plugged in with Xcode but if I run the app without Xcode, app runs about 4 or 5 minutes.After, it is terminated.What is the reason for this?
iOS apps can only run in background, if they fit in one of apples defined background modes such as "App registers for location updates","App provides Voice over IP services","App plays audio","App processes Newsstand Kit downloads","App communicates using CoreBluetooth"",App shares data using CoreBluetooth" and a few more. All background modes you will find in xcode in the capabilities section auf your project(click on project name upper left->mainwindow->second tab).
if your app fits into one of these modes, you must enable this in your app.plist by setting the checkbox in the capabilities section.
if your app doesn't fit in any of these modes you can run in background only a limited amount of time and then iOS stops all activities.
For testing you could start any background mode. but when your app shall be reviewed for deploying via app store apple will reject the app if you use the background mode without legitimation.
The reason for this is that iOS 7 (actually all versions of iOS) will suspend a background task, and potentially terminate it if it's misbehaving, only certain kinds of apps can keep running. Here is the apple doc on it: https://developer.apple.com/library/ios/documentation/iphone/conceptual/iphoneosprogrammingguide/ManagingYourApplicationsFlow/ManagingYourApplicationsFlow.html#//apple_ref/doc/uid/TP40007072-CH4-SW20
So, given your situation, you'd most likely have to "lie" about what type of app your app actually is, which will get you rejected from the app store.
If you do decide to go the route of a hack, be very careful about battery life, cpu usage, and memory usage, as there is a reason apple did this.
FYI: The "type" is set in your Info.plist file.

Resources