I use the locationmanger to get my current location on the iPhone.
#pragma mark - Location handling
-(void)doLocation {
self.locationManager = [[CLLocationManager alloc] init];
[...]
SingletonClass *sharedSingleton = [SingletonClass sharedInstance];
sharedSingleton.coordinate = [location coordinate];
}
- (void)locationManager:(CLLocationManager *)manager
didUpdateToLocation:(CLLocation *)newLocation
fromLocation:(CLLocation *)oldLocation
{
[...]
SingletonClass *sharedSingleton = [SingletonClass sharedInstance];
[sharedSingleton setCoordinate:CLLocationCoordinate2DMake(currentLat, currentLng)];
NSLog(@"debug: self.currentLoc: %@", self.currentLoc);
}
this works fine, I get the location coordinates with some delay and can access them via the sharedSingleton. When I have the coordinates, I have to trigger another function which needs the coordinates as parameter.
And here my issue starts...
How do I now, when the coordinates are retrieved and I can call the other function which needs the coordinates as input parameters. Is there a kind of observer that I could use? If, how do I implement this?
I just need something that tells me: hey dude, the coordinates are available for use, so that I can trigger the next function..