2011-08-08 76 views
0

這是我第一次與位置服務工作,我打這個連接錯誤:可能是什麼建立在這個錯誤的原因 - 「爲i386" 硬件架構未定義的符號

Undefined symbols for architecture 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

+1

您可能想要編輯問題標題以便更具描述性。 –

+0

是的! – Legolas

+0

可能的重複[如何解決未定義的符號錯誤?](http://stackoverflow.com/questions/804510/how-to-resolve-undefined-symbols-error) –

回答

8

您需要CoreLocation框架添加到喲你的項目。

+0

我的不好......... – Legolas

+0

我們都在那裏:) –

1

確保Core Location框架在構建之前鏈接到您的項目。

相關問題