I want to zoom MKMapView
on custom coordinates. So I using following code.
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];
But my app is randomly crashing on setRegion:
Method. And getting this log when it is crashing :-
adjustedRegion description: (MKCoordinateRegion) adjustedRegion = {
center = (latitude = 23.066432958888399, longitude = 72.531898498535213) span = (latitudeDelta = 0.0051205743267423998, longitudeDelta = 0.0048793707173899747) }
Also sometimes getting following error :-
* Terminating app due to uncaught exception 'NSGenericException', reason: '(null) must implement title when canShowCallout is YES on corresponding view >' * First throw call stack: (0x18e8b91b8 0x18d2f055c 0x19ab76244 0x19abb2c74 0x19ab74d44 0x19ab8db58 0x19477c7dc 0x19abb041c 0x19abb0290 0x19abb1588 0x1001ae010 0x1001ad318 0x101265258 0x101265218 0x101275080 0x101274b78 0x18d94b2a0 0x18d94ad8c) libc++abi.dylib: terminating with uncaught exception of type NSException
I am sure not why it is crashing randomly. Let me know if any other proper solution for zooming the MKMapView
on custom coordinates.
Any help would be appreciated.