1
我剛開始使用導航應用程序,很早就遇到了問題。我正在嘗試獲取磁力計數據,但由於某種原因,位置管理員未通過委託呼叫向我發送數據。我正在獲取位置更新,但沒有標題更新。我讀過所有的文檔,只是無法弄清楚......這是一件簡單的事情,這意味着我可能會錯過簡單的東西。下面是我用來初始化位置管理器的代碼:(注意,我使用的是帶有4G的iPad 3,因此它具有GPS芯片組,可能無所謂,但我也應該提及我正在使用ARC。)位置服務不更新iPad上的標題3
- (void)viewWillAppear:(BOOL)animated {
if (!self.locationManager) {
self.locationManager = [[CLLocationManager alloc] init];
self.locationManager.delegate = self;
self.locationManager.distanceFilter = kCLDistanceFilterNone;
self.locationManager.desiredAccuracy = kCLLocationAccuracyBestForNavigation;
[self.locationManager startUpdatingLocation];
if ([CLLocationManager headingAvailable]) {
self.locationManager.headingFilter = kCLHeadingFilterNone;
[self.locationManager startUpdatingHeading];
NSLog(@"Start updating heading.");
}
}
[super viewWillAppear:animated];
}
感謝您的幫助!