I’m getting reports from users that my app crash upon launch.
So I got the crash report. User is on iOS 4.1.
Crash log below:
Thu Nov 17 12:23:49 unknown AppName[1481] <Error>: +[CLLocationManager authorizationStatus]: unrecognized selector sent to class 0x3e2ee618
Thu Nov 17 12:23:49 unknown AppName[1481] <Error>: *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[CLLocationManager authorizationStatus]: unrecognized selector sent to class 0x3e2ee618'
Can’t seem to see anything wrong with my code, here is what I have
- (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error {
// 4.2 and below
NSLog(@"locationManager error = %@", error);
if ([error code] != kCLErrorLocationUnknown) {
[self stopUpdatingLocation:NSLocalizedString(@"Error", @"Error")];
}
}
- (void)locationManager:(CLLocationManager *)manager didChangeAuthorizationStatus:(CLAuthorizationStatus)status
{
// 4.2 & above
NSLog(@"authorization change = %i", status);
}
- (void)stopUpdatingLocation:(NSString *)state {
NSLog(@"stop updatinglocation = %@", self.bestEffortAtLocation);
[locationManager stopUpdatingLocation];
locationManager.delegate = nil;
}
Please enlight.
Thank you,
Tee
I don’t think the error is in the code you listed, somewhere you are trying to access
+[CLLocationManager authorizationStatus]which is a 4.2+ method, so no surprise with the error message there, you have several options. you can check to respondsToSelector: first, or run the code inside of a @try{} block. either one should keep you from crashing.