我有很多的麻烦下面的代码工作之前,我更新到iOS和Xcode的6守则里面viewDidLoad中写到:CLLocation不会开始更新到iOS 8之后更新位置
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
断点
但代码从未运行。
我失去了什么步骤?
编辑:请注意提示询问用户允许位置服务从未出现。我怀疑这是问题所在,但是在我将代理人宣布为自己后,我确实请求了服务。
还增加
<key>NSLocationWhenInUseUsageDescription</key>
<string>Your message goes here</string>
但对我来说还是
[iOS 8:位置服务不工作]的可能的重复(http://stackoverflow.com/questions/24062509/ios-8-location-services-not-working) – 2014-10-09 14:10:54