我想獲取一個位置,然後停止從CLLocationManager
獲取通知。CLLocationManager問題
我這個做:
-(id)initWithDelegate:(id <GPSLocationDelegate>)aDelegate{
self = [super init];
if(self != nil) {
locationManager = [[CLLocationManager alloc] init];
locationManager.delegate = self;
delegate = aDelegate;
}
return self;
}
-(void)startUpdating{
locationManager.distanceFilter = kCLDistanceFilterNone;
locationManager.desiredAccuracy = kCLLocationAccuracyHundredMeters;
[locationManager startUpdatingLocation];
}
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation {
[locationManager stopUpdatingLocation];
[delegate locationUpdate:newLocation];
}
的問題是,即使我在- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:
做[locationManager stopUpdatingLocation];
我仍然得到通知,任何想法,爲什麼會發生?
MTA讓我們知道你是否修復它.. – Stas