0
我有一個應用程序顯示用戶的位置的經度和緯度。應用程序詢問當前位置,並在Xcode中顯示緯度和經度。但在應用程序中,沒有任何反應。位置管理器將不會顯示經度和緯度
這裏是我的代碼:
- (NSString *)deviceLocation {
NSString *theLocation =
[NSString stringWithFormat:@"latitude: %f longitude: %f",
locationManager.location.coordinate.latitude,
locationManager.location.coordinate.longitude];
return theLocation;
}
在viewDidLoad中:
locationManager = [[CLLocationManager alloc] init];
locationManager.distanceFilter = kCLDistanceFilterNone; // whenever we move
locationManager.desiredAccuracy = kCLLocationAccuracyHundredMeters; // 100 m
[locationManager startUpdatingLocation];
NSLog(@"%@", [self deviceLocation]);
的問題是,緯度和經度-labels不會顯示的位置。
@MichaelDautermann,這是我唯一的代碼。 –
我認爲問題是我沒有設置我的標籤與位置管理器一起工作。你能幫我解決這個問題嗎? –