我從這個方法如何獲取用戶在iphone SDK中的模擬器當前位置?
/*Region and Zoom*/
MKCoordinateRegion region;
MKCoordinateSpan span;
span.latitudeDelta=0.2;
span.longitudeDelta=0.2;
CLLocation *location1 = [locationManager location];
CLLocationCoordinate2D location = [location1 coordinate];
location.latitude = location.latitude;
location.longitude = location.longitude;
region.span=span;
region.center = location;
/*Geocoder Stuff*/
MKReverseGeocoder *geoCoder=[[MKReverseGeocoder alloc] initWithCoordinate:location];
geoCoder.delegate = self;
[geoCoder start];
mapView.showsUserLocation = TRUE;
[mapView setRegion:region animated:TRUE];
[mapView regionThatFits:region];
這工作完全,但獲取用戶的位置,當我嘗試運行模擬器,然後它就會在[mapView setRegion:region animated:TRUE];
點這告訴它沒有得到緯度和經度墜毀這段代碼值。那麼我怎麼才能讓這段代碼在模擬器中完美運行。
我必須讓這段代碼在模擬器中運行,有可能嗎?
模擬器不顯示當前位置 – Sarah
是的我知道,但我必須這樣做,這樣纔有可能嗎? –
http://stackoverflow.com/questions/6946966/iphone-simulator-4-3-with-xcode-4-is-not-showing-current-location – Sarah