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

Leg*_*las 0 iphone import cocoa-touch objective-c ios

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

体系结构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];                
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

Fil*_*lic 8

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