繁体   English   中英

当询问用户是否要使用位置服务时,应用程序崩溃

[英]Application crashes when asking if user wants to use Location Services

我有一个使用CoreLocation的iPhone应用程序。

首次安装该应用程序时,会显示iPhone系统消息,询问用户是否要允许位置服务,如果他们单击“是”,我的应用程序会突然显示我的应用程序的第一个屏幕(我正在使用导航控制器),并且崩溃。 这是我在日志中看到的-

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”.

堆栈跟踪看起来像这样 替代文字

我的代码与LocateMe示例(可在我的设备上运行)相距不远。 我有这个:

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

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

有什么想法我做错了吗?

您的导航控制器支持CLLocationManagerDelegate吗? 尝试向您发送事件似乎崩溃了。

您的locationManager:didUpdateToLocation:fromLocation:函数是什么样的?

看来这是此问题的副产品

为了解决这个问题,我遵循了这种方法

基本上,在我的ViewController的dealloc方法中-

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM