我正在尝试将地图跨越到两个坐标的中心。它在以前的 iOS 版本上运行良好,但现在突然,我收到以下错误消息:
*** 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];