ios - Why am I unable to set pin address to annotation's subtitle? -


trying set address of pin position annotation subtitle if == nil. nothing happens.

if (myannotation.subtitle == nil)                     [self.geocoder reversegeocodelocation: locationmanager.location completionhandler:                       ^(nsarray *placemarks, nserror *error) {                           clplacemark *placemark = [placemarks objectatindex:0];                          nsstring *locatedat = [[placemark.addressdictionary valueforkey:@"formattedaddresslines"] componentsjoinedbystring:@", "];                            myannotation.subtitle = locatedat;                       }];                    else {                     myannotation.subtitle = [[ann objectatindex:i] objectforkey:@"address"];                 } 

the thing going on code geocoder asynchronous operation. pins being placed before completion of geocode. depending on how code set may losing reference pin before geocode complete. try geocoding placemark before create annotations.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -