iPhone tracking distance in the background
I was wondering, before learning the whole iPhone development stack, whether it was possible to even write an application in iOS 4 that can sit in the background and tell the user when certain geo-location events have happened? For example, tell a jogger once he has traveled 4 开发者_开发问答miles, but without having to have the application always open?
Thanks!
Yes, this is perfectly possible on iOS 4.x devices. (It's one of the selling points - see the "Background location" section within the What's New in iOS4 blurb.)
If you want to take a look behind the hood, checkout the CLLocationManager Class Reference and the "Executing Code in the Background" section of the iOS Application Programming Guide.
精彩评论