我想在模擬器中獲取我的位置。幾次它的工作,但...現在我總是得到0.000000作爲我的位置。這裏是我使用的代碼:客觀c找出我的位置?
#import <CoreLocation/CoreLocation.h>
CLLocationManager *locationManager = [[CLLocationManager alloc] init];
[locationManager startUpdatingLocation];
CLLocation *location = [locationManager location];
CLLocationCoordinate2D coordinate = [location coordinate];
NSLog(@"%f",location.coordinate.latitude);
NSLog(@"%f",location.coordinate.longitude);
運行應用程序,我在模擬器調試改變後 - >位置 - >自定義位置...是否有人可以解釋爲什麼它停止工作?
你的委託方法在哪裏? – matt