我想在自定義座標上縮放MKMapView
。所以我使用下面的代碼。MKMapView setRegion:導致應用在iOS SDK中崩潰
CLLocationCoordinate2D myCurrentLocationCordinate = CLLocationCoordinate2DMake(latitude, longtitude);
[myMapView setCenterCoordinate:myCurrentLocationCordinate animated:YES];
MKCoordinateRegion viewRegion = MKCoordinateRegionMakeWithDistance(myCurrentLocationCordinate, 500, 500);
MKCoordinateRegion adjustedRegion = [myMapView regionThatFits:viewRegion];
[myMapView setRegion:adjustedRegion animated:YES];
但我的應用程序上setRegion:
方法隨機崩潰。而得到這個日誌當它崩潰: -
adjustedRegion說明:(MKCoordinateRegion)adjustedRegion = {
中心=(緯度= 23.066432958888399,經度= 72.531898498535213)跨度=(latitudeDelta = 0.0051205743267423998,longitudeDelta = 0.0048793707173899747) }
有時也越來越以下錯誤: -
*終止應用程序由於未捕獲的異常 'NSGenericException', 原因: '(空)必須實現標題時canShowCallout是YES上 對應視圖>' *第一擲調用堆棧:(0x18e8b91b8 0x18d2f055c 0x19ab76244 0x19abb2c74 0x19ab74d44 0x19ab8db58 0x19477c7dc 0x19abb041c 0x19abb0290 0x19abb1588 0x1001ae010 0x1001ad318 0x101265258 0x101265218 0x101275080 0x101274b78 0x18d94b2a0 0x18d94ad8c) 的libC++ abi.dylib:與 型NSException
的未捕獲的異常終止我肯定不是爲什麼它是隨機崩潰。讓我知道是否有其他合適的解決方案來縮放自定義座標上的MKMapView
。
任何幫助,將不勝感激。