Graphics Programs Reference
In-Depth Information
Because the CLLocationManager sends the locationMan-
ager:didUpdateToLocation:fromLocation: message to its delegate, you
must implement this method in WhereamiViewController.m . For now, just have
this method print the device's location to the console. (Be very careful that there are no ty-
pos or capitalization errors, or the method won't be called. The selector of the message the
location manager sends must exactly match the selector of the method implemented.)
- (void)locationManager:(CLLocationManager *)manager
didUpdateToLocation:(CLLocation *)newLocation
fromLocation:(CLLocation *)oldLocation
{
NSLog(@"%@", newLocation);
}
You also need to know if the CLLocationManager fails to find its location and why. If
it fails, CLLocationManager sends a different message to its delegate - loca-
tionManager:didFailWithError: . In WhereamiViewController.m , im-
plement this method.
- (void)locationManager:(CLLocationManager *)manager
didFailWithError:(NSError *)error
{
NSLog(@"Could not find location: %@", error);
}
Search WWH ::




Custom Search