max_
max_

Reputation: 24481

Invalid UserLocation iPhone MapKit

I am trying to set the mapView's center coordinate to be the users location:

[self.mapView setCenterCoordinate:[[[self mapView] userLocation] coordinate]];

However I am getting a crash which is to do with the user location being invalid:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Invalid Coordinate -180.00000000, -180.00000000'

Has anyone else had this error before? Or do you know how to fix this?

Upvotes: 3

Views: 1048

Answers (1)

max_
max_

Reputation: 24481

Turns out you need to get the [[[[self mapView] userLocation] location] coordinate] rather than the mapView's userLocation's coordinate.

Upvotes: 3

Related Questions