问题
I have read a number of posts here that it is possible to get location updates while the application is in the background.
My question is what to what extent can I do computing in the background and would I handle it as I would any other code, i.e. just a method call, etc.
Thanks a lot.
回答1:
It is possible, yes. You set the 'location' UIBackgroundModes flag in your Info.plist and then call the Location Manager.
See App States and Multitasking
You can do computing while your application is running in the background, although you run the risk of running down the device battery. It's better to just respond to location events.
回答2:
The Apple documentation is pretty clear about what your app can do while in the background. You cannot do whatever you want while your app is in the background -- there are only a few things you can do (i.e. play audio, track a users location, etc).
Check out Background Execution and Multitasking.
来源:https://stackoverflow.com/questions/10558569/ios-monitor-user-location-in-background