gpt4 book ai didi

ios - MKMapViewDelegate map View :didUpdateUserLocation: method not called on iOS5

转载 作者:行者123 更新时间:2023-11-28 17:42:02 25 4
gpt4 key购买 nike

MKMapViewDelegate mapView:didUpdateUserLocation: 方法在 5.0 模拟器上运行时不会被调用,即使在设备设置中给出了所有位置权限也是如此。

对于 4.3,它工作正常。

有什么想法吗?

最佳答案

重构为 ARC 后我得到了同样的结果。

首先我在viewDidLoad中有如下代码;

CLLocationManager *lm =[[CLLocationManager alloc] init];
lm.delegate = self;
lm.desiredAccuracy = kCLLocationAccuracyBest;
[lm startUpdatingLocation];

我在头文件中做了以下操作

@interface ViewController : UIViewController <CLLocationManagerDelegate>
{
CLLocationManager *locationManager;
}

@property(nonatomic, strong)CLLocationManager *locationManager;

@synthesize locationManager;

我在viewDidLoad中修改的代码

locationManager =[[CLLocationManager alloc] init];
locationManager.delegate = self;
locationManager.desiredAccuracy = kCLLocationAccuracyBest;
[locationManager startUpdatingLocation];

关于ios - MKMapViewDelegate map View :didUpdateUserLocation: method not called on iOS5,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7765572/

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