Не удается получить код для компиляции из-за ошибки в - (void) mapView: (MKMapView *) mapView didUpdateUserLocation: (MKUserLocation *) userLocation
метод.xCode 4 говорит, что «u» является необъявленным идентификатором, как и «*»
. Вот код в файле .m:
#import "WhereamiAppDelegate.h"
@implementation WhereamiAppDelegate
@synthesize window=_window;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions: (NSDictionary *)launchOptions
{
// Create location manager object
locationManager = [[CLLocationManager alloc]init];
// There will be a warning from this line of code, ignore it for now
[locationManager setDelegate:self];
// We want all results from the Location Manager
[locationManager setDistanceFilter:kCLHeadingFilterNone];
// And we want it to be as accurate as possible
// regardless of how much power it takes
[locationManager setDesiredAccuracy:kCLLocationAccuracyBest];
// [locationManager startUpdatingLocation];
[worldView setShowsUserLocation:YES];
// Tell our manager to start looking for its location immediately
[locationManager startUpdatingLocation];
[self.window makeKeyAndVisible];
return YES;
}
- (void)locationManager:(CLLocationManager *)manager
didUpdateToLocation:(CLLocation *)newLocation
fromLocation:(CLLocation *)oldLocation
{
NSLog(@"%@", newLocation);
}
- (void)locationManager:(CLLocationManager *)manager
didFailWithError:(NSError *)error
{
NSLog(@"Could not find location: %@", error);
}
- (void)mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)userLocation
{
CLLocationCoordinate2D loc = [u coordinate];
MKCoordinateRegion region = MKCoordinateRegionMakeWithDistance(loc, 250, 250);
[worldView setRegion:region animated:YES];
}
Скажите, пожалуйста, чтоМне нужно сделать, чтобы преодолеть эту проблему и заставить программу скомпилироваться?
Спасибо.