mardi 30 décembre 2014

coredata NSFetchRequest one to many relationship Relationship fault on managed object

I have a coredata project with the following entities:


I'm trying to get the list of the content base on the category:


here is my coredata clasess .h:



@interface Content : NSManagedObject

@property (nonatomic, retain) NSString * contenido;
@property (nonatomic, retain) NSNumber * index;
@property (nonatomic, retain) NSString * titulo;
@property (nonatomic, retain) NSNumber * uploadCloudKit;
@property (nonatomic, retain) Categories *category;

---

@class Content;

@interface Categories : NSManagedObject

@property (nonatomic, retain) NSString * categoryName;
@property (nonatomic, retain) NSSet *content;
@end



NSEntityDescription *categoryDescription = [ NSEntityDescription entityForName:@"Categories" inManagedObjectContext:moc];

NSFetchRequest *categoRequest = [NSFetchRequest new];
categoRequest.entity = categoryDescription;
NSPredicate *categoPredicate = [NSPredicate predicateWithFormat:@"categoryName like %@", category];
categoRequest.predicate = categoPredicate;
NSArray *results = [moc executeFetchRequest:categoRequest error:&error];


but when I try to access the content on the result for the category I get:



po [results valueForKey:@"content"]
<__NSArrayI 0x6080000243a0>(
Relationship 'content' fault on managed object (0x6080000a2220) <Categories: 0x6080000a2220> (entity: Categories; id: 0x40002b <x-coredata://FDBA3FB2-F1F8-498E-9071-3A5D1ABE66F0/Categories/p1> ; data: {
categoryName = movies;
content = "<relationship fault: 0x610000030fa0 'content'>";
})
)


Any of you knows how can I get the content items of the result?


I'll really appreciate your help




Aucun commentaire:

Enregistrer un commentaire