在构建过程中出现此错误的原因可能是什么 - “架构i386的未定义符号”

时间:2011-08-08 19:48:00

标签: iphone objective-c ios cocoa-touch import

这是我第一次使用位置服务而且我遇到了这个链接器错误:

  

架构i386的未定义符号:“_ OBJC_CLASS _ $ _ CLLocationManager”

我添加了#import <CoreLocation/CoreLocation.h>并在viewDidLoad

中添加了以下行
 CLLocationManager *manager = [[CLLocationManager alloc] init];
manager.delegate = self;
[manager startUpdatingLocation];
[UIApplication sharedApplication].networkActivityIndicatorVisible = YES;

if (![CLLocationManager locationServicesEnabled]){
    UIAlertView *servicesDisabledAlert = [[UIAlertView alloc] initWithTitle:@"Location Services Disabled" message:@"You currently have all location services for this device disabled. If you proceed, you will be asked to confirm whether location services should be reenabled." delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
    [servicesDisabledAlert show];
    [servicesDisabledAlert release];
}
[manager release];                

enter image description here

3 个答案:

答案 0 :(得分:8)

您需要将CoreLocation框架添加到项目中。

答案 1 :(得分:1)

确保在构建之前将Core Location框架链接到您的项目。

答案 2 :(得分:1)

您是否记得在构建阶段将框架添加到项目中?这里...... How to "add existing frameworks" in Xcode 4?