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.