私はこれは完璧に動作しますが、私はシミュレータでこのコードを実行しようとすると、それは[mapView setRegion:region animated:TRUE];
この時点でクラッシュします。このメソッドから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];
をユーザーの場所を取得していますが、それは緯度と経度を取得していません伝えます値。では、このコードをシミュレータで完全に実行させるにはどうしたらいいですか?
私はこのコードをシミュレータで実行する必要がありますか?
シミュレータが現在の位置を表示していません – Sarah
はい私はそれを知っていますが、私はそうする必要がありますか? –
http://stackoverflow.com/questions/6946966/iphone-simulator-4-3-with-xcode-4-is-not-showing-current-location – Sarah