Yordi Uytersprot
Yordi Uytersprot

Reputation: 585

didEnterRegion when app is not running

iOS5. I've got a CLLocationManager set up properly, and it listens to region enters / exits. It all works fine. But when I killed my app, and I entered a region, I received a local notification (which was defined in the didEnterRegion method) AND it started up my application again. Is this standard behaviour or is there something else going on? I thought it would launch the app in the background, perform the didEnterRegion: and kill itself again after a while. All I need to do, is make a HTTP call inside the didEnterRegion:

Anyone who dealt with something similarly?

Upvotes: 0

Views: 988

Answers (1)

k1th
k1th

Reputation: 1332

This is expected behavior. When your application is not running but the geofence border crossing is registered for your app, it will be started and the callback triggered. It will not be killed after that, unless the system decides, it needs the memory.

Don't worry about it, your application will be dormant even if it has been started, so there is no speed/battery/etc penalty.

see docs:

Handling Boundary-Crossing Events for a Region

Every time the user’s current location crosses a boundary region, the system generates an appropriate region event for your app. If your app is already running, these events go directly to the delegates of any current location manager objects. If your app is not running, the system launches it in the background so that it can respond. Apps can implement the following methods to handle boundary crossings:

Upvotes: 2

Related Questions