这是我的课

@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

这里是Exercise
@class Exercise;

@interface Question : NSManagedObject

@property (nonatomic, retain) NSNumber * aID;
@property (nonatomic, retain) id jsAnswer;
@property (nonatomic, retain) Exercise *exercise;

@end

这些类是由coredata创建的
如何在每次练习中通过Question获取所有Question对象

最佳答案

这将为您提供给定练习的所有问题对象的数组:

NSArray *questions = [[exercise listQuestion] allObjects];

09-11 20:30