这是我第一次使用位置服务而且我遇到了这个链接器错误:
架构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];
答案 0 :(得分:8)
您需要将CoreLocation框架添加到项目中。
答案 1 :(得分:1)
确保在构建之前将Core Location框架链接到您的项目。
答案 2 :(得分:1)
您是否记得在构建阶段将框架添加到项目中?这里...... How to "add existing frameworks" in Xcode 4?