-->

Application crashes when asking if user wants to u

2019-06-12 16:49发布

问题:

I have an iPhone app that is using CoreLocation.

Upon first installing the app, the iPhone system message is displayed asking whether or not the user wants to allow location services, if they click yes, my app suddenly displays the first screen of my app (I'm using a navigation controller), and crashes. This is what I see in the log -

warning: UUID mismatch detected with the loaded library - on disk is:
/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/System/Library/PrivateFrameworks/CoreTelephony.framework/CoreTelephony
=uuid-mismatch-with-loaded-file,file="/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/System/Library/PrivateFrameworks/CoreTelephony.framework/CoreTelephony"
Program received signal:  “EXC_BAD_ACCESS”.

And the stack trace looks like this

My code isn't too far off from the LocateMe sample (which works on my device). I have this:

CLLocationManager *clLocationManager = [[CLLocationManager alloc] init];
clLocationManager.delegate = self;

if (clLocationManager.locationServicesEnabled) {
    [clLocationManager startUpdatingLocation];
} else {
    self.searchBar.placeholder = @"Enter location";
}

Any idea on waht I'm doing wrong?

回答1:

does your navigation controller support CLLocationManagerDelegate? it looks like it's crashing trying to send you an event.

what does your locationManager:didUpdateToLocation:fromLocation: function look like?



回答2:

It looks like this is a byproduct of this question

To solve the problem, I wound up following this approach

Basically, in my ViewController's dealloc method -

- (void)dealloc {
locationManager.delegate = nil;
[locationManager release];
}