I am very new to developing in iOS. I am trying to pass some data through a segue in a table view. Here is what I am calling to pass the data:
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if([segue.identifier isEqualToString:@"ShowContactDetails"]) {
ContactDetailsViewController *dvc = [segue destinationViewController];
NSIndexPath *path = [self.tableView indexPathForSelectedRow];
Contact *c = [jsonResults objectAtIndex:path.row];
[dvc setSelectedContact:c];
}
}
It passes fine and when I do a NSLog on selectedContact, this is what I get:
2012-05-21 15:15:42.410 Test[8352:f803] {
category = Prospect;
id = 19895;
label = "John Doe";
}
The problem is, I don’t know how to access those items individually. I have tried to call things like objectForKey but I get an error.
From the output of your NSLog, selectedContact seems to be an NSDictionary object. Try using [selectedContact valueForKey] instead of [selectedContact objectForKey].
For example: