iOS Dev Nugget 239 Core Location Background Updates


Need to run a code review on your codebase? Hire me

This tip is if you work with Core Location and wants to continue receiving location updates while the app is suspended.

You need to add the UIBackgroundModes key with value location to the app's Info.plist. In addition, — this is easy to miss because it was only added in iOS 9 — you want to set CLLocationManager's allowsBackgroundLocationUpdates property to true. In addition to getting updates while the app is suspended, if the app is killed and the device crosses the CLRegion you are monitoring, the app will be automatically launched. So this property is also useful for toggling that behavior.

Your feedback is valuable: Do you want more nuggets like this?   Yes   or   No


Like this and want such iOS dev nuggets to be emailed to you, weekly?

Sign Me Up! or follow @iosdevnuggets on Twitter


View archives of past issues