位置管理器错误

Naj*_*hah 4 iphone objective-c ios

我正在使用位置经理

Undefined symbols for architecture i386:
  "_OBJC_CLASS_$_CLLocationManager", referenced from:
      objc-class-ref in ViewController.o
  "_kCLLocationAccuracyHundredMeters", referenced from:
      -[ViewController viewDidLoad] in ViewController.o
  "_kCLDistanceFilterNone", referenced from:
      -[ViewController viewDidLoad] in ViewController.o
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status
Run Code Online (Sandbox Code Playgroud)

我将corelocation.framework添加到我项目的frameworks文件夹中,该项目在清理方面取得了成功,但失败并在构建时给出了同样的三个错误

Rah*_*rma 7

您需要导入已经完成的框架还将以下内容添加到您正在使用CLLocation类的.h文件中,例如

#import <UIKit/UIKit.h>
#import <CoreLocation/CoreLocation.h>

@interface UntitledViewController : UIViewController <CLLocationManagerDelegate> {
    CLLocationManager*      locationManager;
    CLLocation*             locationObject;
}

@end
Run Code Online (Sandbox Code Playgroud)

希望能帮助到你!!