在模擬器中,我設置了debug-> location->自定義位置的經度和緯度。ios:調試自定義位置不起作用
然後,在代碼我有:
- (void)updateMap{
MKCoordinateSpan span;
span.latitudeDelta = .6;//The amount of north-to-south distance (measured in degrees) to display on the map
span.longitudeDelta = .6;//The amount of east-to-west distance (measured in degrees) to display for the map region
MKCoordinateRegion region;
region.center = _ls.coordinate;
region.span = span;
[mapView setRegion:region animated:TRUE];
}
在一個不同的文件I獲得@屬性(非原子,只讀)CLLocationCoordinate2D座標;
- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations{
//Get the latitude and longitude location
CLLocation *lastLocation = [locations lastObject];
_latitude = [[NSString alloc] initWithFormat:@"%f", lastLocation.coordinate.latitude];
_longitude = [[NSString alloc] initWithFormat:@"%f", lastLocation.coordinate.longitude];
_coordinate = lastLocation.coordinate;//manager.location.coordinate;
}
當我運行應用程序模擬器不斷顯示舊金山。任何想法爲什麼?
這個下拉是哪裏?我使用Simulator Debug下拉菜單輸入了一個位置的經度和緯度,但我仍舊得到舊金山。 – wwjdm
它是在Xcode中,在調試輸出窗口上方看到:http://stackoverflow.com/questions/214416/set-the-location-in-iphone-simulator – tcarlander