gpt4 book ai didi

iphone - iOS >4.0 中的 locationServicesEnabled 始终显示 UIAlert

转载 作者:行者123 更新时间:2023-12-03 20:56:44 24 4
gpt4 key购买 nike

我尝试让 locationServicesEnabled 功能正常工作...但是无论 locationServices 是否启用,我的 UIAlert 都会显示!我怎样才能让它正常工作?

 @synthesize locationServicesEnabled
-(void)viewDidLoad {
[super viewDidLoad];

if(![CLLocationManager locationServicesEnabled]) {
self.locationManager = [[[CLLocationManager alloc] init] autorelease];
locationManager.delegate = self;
locationManager.desiredAccuracy = kCLLocationAccuracyBest;
[locationManager startUpdatingLocation];
} else {
[[[[UIAlertView alloc] initWithTitle:@"Location services."
message:@"Location services are disabled."
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil] autorelease] show];
}
}

提前谢谢您!

最佳答案

看来你的情况已经倒退了。目前它显示“如果未启用位置服务,则开始更新其他警报”。

if更改为:

if([CLLocationManager locationServicesEnabled])

删除!

关于iphone - iOS >4.0 中的 locationServicesEnabled 始终显示 UIAlert,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4539919/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com