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/