0
由于某种原因我的代码导致我的程序崩溃。有谁知道为什么或如何解决它?iPhone模拟器崩溃,当它试图访问用户位置
NSLog(@"here");
CLLocation *location = [locationManager location];
[mapView removeAnnotations:mapView.annotations];
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
CLLocationCoordinate2D workingCoordinate = [location coordinate];
NSLog(@" this is %@", workingCoordinate.latitude);
它使它成为第一个NSLog,但在第一个和第二个之间崩溃。我的猜测是它与CLLocation *位置线有关。
允许程序工作,但它给了一个不可能的纬度:14212.在我的地图上,虽然它将这个注释的坐标添加到纬度0 long 0 – 2010-06-18 03:03:43
这是因为经度和纬度是双倍的,所以你可以不使用%d,你可以使用%f格式说明符。检查[文档中的CLLocationDegrees定义](http://developer.apple.com/iphone/library/documentation/CoreLocation/Reference/CLLocation_Class/CLLocation/CLLocation.html) – progrmr 2010-06-18 03:18:00
Duh。当然。谢谢。 – bbum 2010-06-18 12:36:26