获取来自coredata所有对象在一个一对多的关系
问题描述:
这是我Exercise
类获取来自coredata所有对象在一个一对多的关系
@class Question;
@interface Exercise : NSManagedObject
@property (nonatomic, retain) NSNumber * aID;
@property (nonatomic, retain) NSString * name;
@property (nonatomic, retain) NSSet *listQuestion;
@end
@interface Exercise (CoreDataGeneratedAccessors)
- (void)addListQuestionObject:(Question *)value;
- (void)removeListQuestionObject:(Question *)value;
- (void)addListQuestion:(NSSet *)values;
- (void)removeListQuestion:(NSSet *)values;
@end
,这里是Question
@class Exercise;
@interface Question : NSManagedObject
@property (nonatomic, retain) NSNumber * aID;
@property (nonatomic, retain) id jsAnswer;
@property (nonatomic, retain) Exercise *exercise;
@end
这些类是由coredata
创建的类我怎样才能通过listQuestion
获得全部Question
对象每次练习
答
Thi s会给你一个给定练习的所有Question对象的数组:
NSArray *questions = [[exercise listQuestion] allObjects];