Issue
Ok, I know I must be doing something wrong, but darned if I can figure it out,
Basically I am trying to get the VisibleMapRect in the regionDidChangeAnimated call, but it appears as though this call is being fired before the value is actually being set, because the mapView.visibleMapRect value is NULL the first time it is called.
Attepting to do a comparison between mapView.visibleMapRect to nil, is invalid operand to binary expression (MKMapRect to void*)
NSLog(@"VISIBLE MAP RECT %d",mapView.visibleMapRect);
Shows 0 every time.
NSLog(@"Visible Map Rect %@",mapview.visibleMapRect)
show (null) every time.
So what do I do? How the heck to I test around this case? Comparing to nil isn't acceptable. I know there must be a way to handle this, but I am flumoxed at the moment.
Solution
The visibleMapRect
property is of type MKMapRect
which is a struct so %d and %@ won't work on the struct.
You need to either log the individual fields within the MKMapRect
or use the MapKit function MKStringFromMapRect
:
NSLog(@"Visible Map Rect %@",MKStringFromMapRect(mapView.visibleMapRect));
Answered By - user467105
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.