In my iOS7 app I have a singleton called ICVModel. When the app starts this singleton gets initialized and creates CLLocationManager
which immediately starts updating location. This works fine, CLLocationManager
is a strong property in ICVModel
. I have implemented didUpdateLocations:
to always save last location to ICVModel
's strong property on this singleton.
My problem is that when the app goes to background and than becomes active again, i always get EXC_BAD_ACCESS in didUpdateLocations:
- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations
{
[ICVModel sharedSingleton].lastLocation = [locations lastObject]; //EXC_BAD_ACCESS
}
Also my app uses region based notifications, so isn't it possible that in this case this method is called when the app is in background (and ICVModel is deallocated?)?
I have no idea why... Thanks a lot!