【发布时间】:2011-03-05 14:03:13
【问题描述】:
为什么我的单例中的这个 CLLocationManager 不起作用?我拿了这个代码http://jinru.wordpress.com/2010/08/15/singletons-in-objective-c-an-example-of-cllocationmanager/
根本没有改变他的代码(所以如果我应该在他的代码中添加一些东西,请告诉我)这是我的第一个单身人士。
- (CLLocationManager *)locationManager {
if (locationManager != nil) {
return [LocationController sharedInstance].locationManager;
}
self.locationManager = [LocationController sharedInstance];
[LocationController sharedInstance].locationManager.desiredAccuracy = kCLLocationAccuracyNearestTenMeters;
return [LocationController sharedInstance].locationManager;
}
-
(void)viewDidLoad { [超级viewDidLoad];
// Start the location manager. [LocationController sharedInstance].delegate = self; //[[self locationManager] startUpdatingLocation]; [[LocationController sharedInstance].locationManager startUpdatingLocation];
【问题讨论】:
标签: iphone objective-c singleton cllocationmanager