Home | Contact us | Blog
Home Services Portfolio Our applications Contact us Blog

While working with MKMapView, I've been getting an NSInvalidArgumentException from the MKMapView on the setRegion: selector to zoom in on the current location of the user. What this seems to have a problem with for me is when I'm trying to set the initial zoom on the map and intermittently this throws the following exception:

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Invalid Region '

They key here is the latitude and longitude, both are set to -180. Which is obviously invalid for latitude. The issue seems to be that the GPS subsystem of the phone (in this case the simulator) has not yet been initialised so the location of the user has not yet been found. To get around this, I have added in a check in the code to ensure that no zoom takes place until the GPS system responds with sane coordinates.



Home Services Portfolio Our applications Contact us Blog