I have an app using Core Location. In the Xcode Organizer I see a series of crashes related to CLConnection. The worst of the crashes happen in:
- CLConnection::sendMessageInternal
- CLConnection::sendCachedMessage
- CLConnection::sendMessage
- CLNameValuePair::copyInternal
As far as I can tell, these crashes are happening while the app is in the background. According to iTunesConnect's analytics my app is crashing for about 1 out of 10 sessions. I haven't heard any complaints from users and these crashes do not appear in the third-party crash reporting tool I use.
I have only found this one thread online related to this subject: http://stackoverflow.com/questions/32698342/crash-on-clconnectionsendmessageinternal
However, I don't believe this person's fix applies to my code.
I only create a CLLocationManager once when the app launches:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
...
self.locationManager = [[CLLocationManager alloc] init];
self.locationManager.delegate = self;
...
}
I stop updating locations when the app enters background.
- (void)applicationDidEnterBackground:(UIApplication *)application {
[self.locationManager stopUpdatingLocation];
...
}
I restart updating locations when the app will enter foreground:
- (void)applicationWillEnterForeground:(UIApplication *)application {
...
self.locationManager.delegate = self;
[self.locationManager startUpdatingLocation];
...
}
One other detail worth mentioning is that I am using region monitoring as well. I use the same CLLocationManger to start and stop monitoring for my regions.
Reproducting these crashes is very hard and there is very little information to go with. Any help would be very much appreciated.