I am currently using CoreLocation to set up geofences and need the app to store events in a database whenever the user enters or exits a geofence. It works when the app is running or in the background, but I need it to somehow execute the database saving code of the app even when the app is terminated (i.e. closed by swiping up on the multitasking menu).
I am using iOS 7.1 which I thought automatically did this, but it is not working for me. How can I get this to work? I am using the startMonitoringForRegion method in the CLLocationManager class to monitor the regions. Is there something extra I need to do so that the app will be notified in the background? Also, where would the database saving code go in the app for when the app is restarted (currently it is in the didFinishLoadingWithOptions menu of the app delegate).