我在尝试使用核心数据运行此应用程序时遇到错误。由于未捕获的异常'NSInvalidArgumentException'而终止应用程序,原因:'对多关系的不可接受的值类型:属性=“成分”;所需类型 = NSSet; 给定类型 = 成分;
我看到核心生成的访问器 addIngredient: 和 removeIngredient: 都将 NSSet 作为参数,所以我尝试将其更改为成分,但这没有帮助。我怀疑虽然我更改了标头中的参数,但在实现中发生了一些我看不到的事情?建议?
食谱.h
@class IngredientList;
@interface Recipe : NSManagedObject
@property (nonatomic, retain) NSString * recipeName;
@property (nonatomic, retain) IngredientList *ingredientList;
@end
成分列表.h
@class Ingredient, Recipe;
@interface IngredientList : NSManagedObject
@property (nonatomic, retain) Recipe *recipe;
@property (nonatomic, retain) NSSet *ingredient;
@end
@interface IngredientList (CoreDataGeneratedAccessors)
- (void)addIngredientObject:(Ingredient *)value;
- (void)removeIngredientObject:(Ingredient *)value;
- (void)addIngredient:(NSSet *)values;
- (void)removeIngredient:(NSSet *)values;
@end
成分.h
@class IngredientList;
@interface Ingredient : NSManagedObject
@property (nonatomic, retain) NSString * ingredientName;
@property (nonatomic, retain) IngredientList *ingredientList;
@end