0

我开始在目标 C 中开发自己的导航地图,但最近使用 MapKit 陷入了死胡同。

我有 XCode 4.5,iOS 目标设置为 6.0。和 MapKit 框架通过 Link Binary With Libraries 加载。

错误如下所示:

dyld: lazy symbol binding failed: Symbol not found: \314CGRectIsEmpty
  Referenced from: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.0.sdk/System/Library/Frameworks/MapKit.framework/MapKit
  Expected in: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.0.sdk/System/Library/Frameworks/CoreGraphics.framework/CoreGraphics

dyld: Symbol not found: \314CGRectIsEmpty
  Referenced from: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.0.sdk/System/Library/Frameworks/MapKit.framework/MapKit
  Expected in: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.0.sdk/System/Library/Frameworks/CoreGraphics.framework/CoreGraphics

当我开始时,它工作得很好,但后来我添加了工具栏项和 currentLocation 按钮等功能,这个疯狂的错误开始出现。首先,我认为我的代码有问题。但是后来我有一个可以工作的程序,并添加了功能,它开始抛出这个错误,当我把它放回去时,错误仍然存​​在。这是 MapViewController 的代码。

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{


}

- (void)viewWillAppear:(BOOL)animated {

    // 1
    CLLocationCoordinate2D zoomLocation;
    zoomLocation.latitude = 50.07499;
    zoomLocation.longitude= 14.43976;
    // 2
    MKCoordinateRegion viewRegion = MKCoordinateRegionMakeWithDistance(zoomLocation, 10000, 10000);
    // 3
    MKCoordinateRegion adjustedRegion = [self.mapView regionThatFits:viewRegion];
    // 4
    [self.mapView setRegion:adjustedRegion animated:YES];
    if (self.mapView.userLocationVisible){
        self.currentLocationButton.enabled = YES;
    }else{
        self.currentLocationButton.enabled = NO;
        timer = [NSTimer scheduledTimerWithTimeInterval:5.00 target:self selector:@selector(checkGeolocationAvailible) userInfo:nil repeats:YES];
        [timer fire];
    }






}

- (IBAction)checkGeolocationAvailible {
    if (self.mapView.userLocationVisible){
        self.currentLocationButton.enabled = YES;
        [timer invalidate];
    }
}

- (IBAction)showCurrentLocation {
    if (self.mapView.userLocationVisible){
        [self.mapView setCenterCoordinate:self.mapView.userLocation.coordinate];
    }
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
4

0 回答 0