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

标签 ios mkmapview ios5 mkmapviewdelegate

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/

相关文章:

ios - PFQueryTableView 自定义单元格分隔符不显示

ios - Xcode Swift 删除 MKPolyline

iphone - 有没有办法限制 MKMapView 最大缩放级别?

objective-c - 多语言本地化 Storyboard支持问题

objective-c - 如何从代码中选择 UICollectionView 的项目/单元格

ios - 核心数据的Objective-C日期格式

ios - 如何将Signal转换为SignalProducer

ios - 我将如何使用地名然后使用 MKMapView 进行搜索?

iphone - 雪豹的ios5崩溃,但Lion os可以

objective-c - iOS 5 横屏模式下 iPad 上的 navigationBar 背景图片