+(void) vStartUpdatingLocation
{
while (false);
AssertNonMainThread
[[NSOperationQueue mainQueue]addOperationWithBlock:^{
CLLocationHandler * singleton = [CLLocationHandler singleton];
CLLocationManager * locationManager = singleton.locationManager;
NSAssert(locationManager.delegate==singleton,@"They are meant for each other"); //Assertion here
[locationManager startUpdatingLocation]; //update location
PO(singleton.locationManager);
PO(singleton.locationManager.delegate);
PO(singleton); //verify that locationManager.delegate == singleton
while(false);
}];
}
- (void)locationManager:(CLLocationManager *)manager
didUpdateToLocation:(CLLocation *)newLocation
fromLocation:(CLLocation *)oldLocation
{
AssertMainThread;//break point here never called
PO(self.locationManager);
PO(manager);
while(false);
[self finishUpdating];
[self updateCurrentPlaceCache:newLocation];
}
-(void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error
{
[self finishUpdating]; //no love here too
}
我把大部分信息放在评论上。
我已经验证 locationManager.delegate 确实是 CLLocationHandler 类型的单例对象
然而
- (void)locationManager:(CLLocationManager *)manager
didUpdateToLocation:(CLLocation *)newLocation
fromLocation:(CLLocation *)oldLocation
-(void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error
不叫。它曾经工作过。