【发布时间】:2014-10-09 14:04:19
【问题描述】:
更新到 iOS 8 后我遇到了很多麻烦。以下代码在我更新到 iOS 和 Xcode 6 之前有效。代码是在 viewDidLoad 中编写的:
self.locationManager.delegate = self;
[self.locationManager requestWhenInUseAuthorization];
self.locationManager.desiredAccuracy = kCLLocationAccuracyBest;
[self.locationManager startUpdatingLocation];
在我的 .h 文件中,我将 locationManager 作为属性,同时声明 CLLocationManagerDelegate:
@property CLLocationManager *locationManager;
我在里面设置了断点
-(void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations
但代码从未运行过。
我错过了什么步骤???
编辑:请注意,要求用户允许定位服务的提示从未出现。我怀疑这是问题所在,但在我将委托声明为 self 之后,我确实请求了服务。
也添加了
<key>NSLocationWhenInUseUsageDescription</key>
<string>Your message goes here</string>
但仍然不适合我
【问题讨论】:
标签: ios ios8 xcode6 cllocationmanager cllocation