Background Location Services not working in iOS 7

2020-01-22 13:07发布

I've recently upgraded my iOS devices to use iOS 7. One of the apps that we're developing uses background location services to track device location and all of our testers have reported that the app no longer appears to track in the background under iOS 7.

We have verified that backgrounding for the app is enabled in the settings on the device and the previous build worked flawlessly under iOS 6. Even if the device were cycled, the app would restart after a location update.

Is there something else that needs to be done to make this work under iOS 7?

7条回答
时光不老,我们不散
2楼-- · 2020-01-22 13:37

I found another thread Start Location Manager in iOS 7 from background task Sash mentioned that

I found the problem/solution. When it is time to start location service and stop background task, background task should be stopped with a delay (I set 1 second). Otherwise location service wont start.

Can anyone try that and verify?

Nikolay, can you paste your code here? I tried to restart the location manager every 8 minutes but it does not run continuously.

Update:

After searching High and Low, I found the Solution from Apple Forum!

In iOS 7, you can not start the location service in background. If you want the location service to keep running in the background, you have to start it in foreground and it will continue to run in the background.

If you were like me, stop the location service and use timer to re-start it in the background, it will NOT work.

For more detailed information, you can watch the first 8 minutes of video 307 from WWDC 2013: https://developer.apple.com/wwdc/videos/

Feb 2014 Update: I can get the location continuously from device using iOS 7 after several months of trying. You may see the full answer here: Background Location Services not working in iOS 7

查看更多
登录 后发表回答