I have coredata project here is my .h file:
@interface Content : NSManagedObject
@property (nonatomic, retain) NSString * title;
@property (nonatomic, retain) NSString * body;
@property (nonatomic, retain) Categories *category;
@property (nonatomic, retain) NSSet *tags;
@end
@interface Content (CoreDataGeneratedAccessors)
- (void)addTagsObject:(Tags *)value;
- (void)removeTagsObject:(Tags *)value;
- (void)addTags:(NSSet *)values;
- (void)removeTags:(NSSet *)values;
And I'm populating the my coredata as follows:
NSError *error = nil;
// Categories:
NSManagedObjectContext *moc = [self managedObjectContext];
NSEntityDescription *contentDescription = [ NSEntityDescription entityForName:@"Categories" inManagedObjectContext:moc];
NSFetchRequest *categoRequest = [NSFetchRequest new];
categoRequest.entity = contentDescription;
NSPredicate *categoPredicate = [NSPredicate predicateWithFormat:@"category like %@", _dropMenuOulet.stringValue];
categoRequest.predicate = categoPredicate;
NSArray *results = [moc executeFetchRequest:categoRequest error:&error];
Categories *catego = (Categories*) [results objectAtIndex:0];
// Tags:
NSEntityDescription *tagsDescription = [ NSEntityDescription entityForName:@"Tags" inManagedObjectContext:moc];
NSFetchRequest *tagsRequest = [NSFetchRequest new];
tagsRequest.entity = tagsDescription;
NSArray *tagsResults = [moc executeFetchRequest:tagsRequest error:&error];
Content *content1 = [NSEntityDescription insertNewObjectForEntityForName:@"Content" inManagedObjectContext:moc];
content1.category = catego;
content1.title = _titleOutlet.stringValue;
content1.body = _bodyOutlet.stringValue;
NSMutableSet *tagSet = [NSMutableSet set];
for (NSManagedObject *obj in tagsResults)
{
[tagSet addObject:obj];
}
content1.tags = tagSet;
My problem right now is when I try to access to the tags in the content I get the following:
tags = "<relationship fault: 0x60000002d820 'tags'>";
How can access to the tags of the content?