我从这个方法如何获取用户在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