Follow best practices to optimize use of location services for energy efficiency. Doing so automatically stops location services once the request has been fulfilled, letting location hardware power down if not being used elsewhere.Location updates requested in this manner are delivered by a callback to the With the exception of navigation apps that offer turn-by-turn directions, most apps don’t need location services to be on all the time.Turn location services on only when they’re needed.Then, leave them on just long enough to get a location fix and turn them off again.Using location-based information in your app is a great way to keep the user connected to the surrounding world.However, improper or unnecessary use of location can prevent the device from sleeping, keep location hardware powered up, drain the user’s battery, and create a poor user experience. Select your project file, then select targets and then add Core Location.framework as shown below − Step 3.This is a follow-up to my post on why you should unit test Cocoa and i Phone applications.
Note the really key features here; a) If the application is suspended when an update occurs, the system wakes it up in the background to handle the update.
If your app is terminated, the delivery of new location events stops altogether.
Call this method whenever your code no longer needs to receive location-related events.
Calling stop Updating Location in between, however, does cause a new initial event to be sent the next time you call this method.
If you start this service and your app is suspended, the system stops the delivery of events until your app starts running again (only in foreground).