Thursday, April 21, 2011

Returning Mapkit Userlocation Coordinates

whenever I try to return the lat/long coordinates for my current location, my application crashes with no explanation of the error...

NSLog(@"%@", mapView.userLocation.location.coordinate);

I am waiting until the phone finds the location as well...

From stackoverflow
  • mapView.userLocation.location.coordinate is a struct while the %@ format specifier expects an object. This will work:

    NSLog(@"%f, %f", mapView.userLocation.location.coordinate.latitude,
                     mapView.userLocation.location.coordinate.longitude);
    

0 comments:

Post a Comment