Accessing CoreData relationships
Posted
by georgeliquor
on Stack Overflow
See other posts from Stack Overflow
or by georgeliquor
Published on 2010-05-02T14:17:45Z
Indexed on
2010/05/02
14:28 UTC
Read the original article
Hit count: 179
I have the following core data model with two entities:
entity "item" which holds name, date, description and a to many relationship "image". image is optional.
entity "image" holds url, name and relationship to one item.
I load the executed Fetchrequest into this NSArray "entityArray"
This is what I do to display my data in a UITableView for example to display title in main cell:
NSManagedObject *object = (NSManagedObject *)[entityArray objectAtIndex:indexPath.row];
cell.textLabel.text=[object valueForKey:@"title"];
Now I have no clue how to access my relationship image ([object valueForKey:@"image"]), because it contains more than just a string.
© Stack Overflow or respective owner