I am just curious, is there a way to print via NSLog the contents of a struct?
id <MKAnnotation> mp = [annotationView annotation];
MKCoordinateRegion region =
MKCoordinateRegionMakeWithDistance([mp coordinate], 350, 350);
I am trying to output whats in [mp coordinate]
for debugging.
.
I cracked it, well unless there is another way.
CLLocationCoordinate2D location = [mp coordinate];
NSLog(@"LAT: %f LON: %f", location.latitude, location.longitude);
As I am aware there's no generic way to log struct value - if you know its components you can just log them explicitly as you do with CLLocationCoordinate2D
. However in your class you can implement -description
and/or -descriptionWithLocale:
method and log class instances:
NSLog([mp description]);
//or
NSLog(@"%@", mp);
There are also convenience methods for creating NString from some standard structures: NSStringFromCGAffineTransform
, NSStringFromCGPoint
, NSStringFromCGSize
etc
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With