在构build过程中出现这种错误的原因可能是“架构i386的未定义符号”

这是我第一次使用位置服务,我正在碰到这个链接错误:

架构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]; 

在这里输入图像说明

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

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

您是否记得在构build阶段将框架添加到您的项目中? 这里… 如何在Xcode 4中“添加现有的框架”?