我有很多的麻煩下面的代碼工作之前,我更新到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