I have a segue set from UITableViewController A to UITableViewController B. In the prepareForSegue, based on the list item selected, I want to retrive the associated NSManagedObjectID from an 'items' array (I am not using a fetched results controller yet). I will then send this ID to controller B so I can filter the list items to only those associated with the selected item.
I can get the indexPath of the selected list item using
[self.tableView indexPathForSelectedRow];
and my plan was to use this to find the corresponding item in my 'items' array. Presumably the indexPath has some kind of numerical attribute that corresponds to the index I should look up in my array?
a) Is there some attribute of the indexPath that will correlate to the index of the associated array object? It seems a bit unreliable, since I can't know how my array is filled (ordering etc). b) If so, how do I find the array item using the indexPath? c) Is there a better way to do all this (without using a fetched results controller)? I've read elsewhere that the NSManagedObjectID is a sensible thing to pass on to the second controller.