0
无法获得,因为在 错误的代码编译 - (空)的MapView:(*的MKMapView)的MapView didUpdateUserLocation:(MKUserLocation *)用户位置无法获得Mapkit类,方法编译
方法。 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];
}
能否请你告诉我,我需要做的克服这个问题并让程序编译?
谢谢。
哈,我很尴尬!但是,谢谢你,现在它工作! – pdenlinger