2012-05-26 54 views
1

这是我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对象每次练习

回答

4

Thi s会给你一个给定练习的所有Question对象的数组:

NSArray *questions = [[exercise listQuestion] allObjects]; 
相关问题