1

When passing data to a new viewController after clicking on a pin on a map view with MapKit, I have problem with the annotation index when clicked on rightCallOutAccesoryView. It is not correlating to the index of my NSArray 'kundUppgifter'. I know it has to do with showUserLocation but also that it is a random order of the index generated. But, I can get the title of the pin clicked on by NSString *passedId = view.annotation.title; That title is also a cell named cName in my array.

To get around this I would like to read a post from my array 'kundUppgifter' as this:

PFObject *tempObject = [kundUppgifter objectForKey passedId]

but it is not working.

(I have read something about that it has to be a NSDictionary to read with key of type string, but how do I make a NSDictionary out of a NSArray, if so? I am as you understand, quite new to Xcode, so please explain on a newbe-level. For example if I have to declare something; is it in the .h or .m-file and so on)

So how would I write the query?

(I have a db called app_1077 at parse.com with the same cell @"cName" if it is more easy to get it from there, and in that case, how to write that query?)

I am very very thankful for an answer!

PS: I have also got the advice to add data to the annotation.view when adding my array of pins to it in the beginning but I don't understand how to do this. I have a class called Annotation.h and Annotation.m DS.

  • The advice is not to add data to the annotation.view. The advice is to add data to the annotation (the class that implements the MKAnnotation protocol) -- not the view. The "index not correlating" has nothing to do with showsUserLocation. The map view's annotations array is not guaranteed to be in the order you added the annotations -- _do not rely on the order of that array_. –  Sep 30 '14 at 13:12
  • See http://stackoverflow.com/questions/20863536/pass-parse-pfobject-objectid-to-map-annotation-view-button-title, http://stackoverflow.com/questions/23444166/map-with-photos-like-instagram-photo-map –  Sep 30 '14 at 13:13

0 Answers0