爲什麼這個CLLocationManager在我的單例中不起作用?我拿這個代碼http://jinru.wordpress.com/2010/08/15/singletons-in-objective-c-an-example-of-cllocationmanager/Singleton LocationManager開始更新?
根本沒有改變他的代碼(所以如果我應該添加一些東西給他的代碼讓我知道)它有史以來第一個單身人士。
- (CLLocationManager *)locationManager {
if (locationManager != nil) {
return [LocationController sharedInstance].locationManager;
}
self.locationManager = [LocationController sharedInstance];
[LocationController sharedInstance].locationManager.desiredAccuracy = kCLLocationAccuracyNearestTenMeters;
return [LocationController sharedInstance].locationManager;
}
(無效)viewDidLoad中 { [超級viewDidLoad中];
// Start the location manager. [LocationController sharedInstance].delegate = self; //[[self locationManager] startUpdatingLocation]; [[LocationController sharedInstance].locationManager startUpdatingLocation];