1
我試圖跨越兩個座標中心的地圖。它工作得很好iOS上的早期版本,但現在突然,我收到此錯誤信息:iOS6中的MapView在縮放地圖時崩潰
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Invalid Region <center:nan, nan span:nan, nan>'
什麼地方不對勁任何想法?
CLLocationCoordinate2D savedCoordinate;
savedCoordinate.latitude = [userDef doubleForKey:@"savedCoordinate-latitude"];
savedCoordinate.longitude = [userDef doubleForKey:@"savedCoordinate-longitude"];
savedPosition = savedCoordinate;
CLLocationDistance visibleDistance = 100;
MKCoordinateRegion region = MKCoordinateRegionMakeWithDistance(savedCoordinate, visibleDistance, visibleDistance);
MKCoordinateRegion adjustedRegion = [mapView regionThatFits:region];
[mapView setRegion:adjustedRegion animated:NO];
[USERDEF setDouble:location.latitude forKey:@ 「savedCoordinate緯度」]; [userDef setDouble:location.longitude forKey:@「savedCoordinate-long」]; [userDef setBool:YES for forKey:@「savedCoordinate-exist」]; ,我應該存儲其他東西,而不是一個雙? – Christoffer
在傳入'MKCoordinateRegionMakeWithDistance'之前'savedCoordinate'看起來像什麼? –