我生成的模型对象有很多错误:
ExerciseSet.h
1 @class Exercise;
2
3 @interface ExerciseSet : NSManagedObject
4
5 @property (nonatomic, retain) NSNumber * order;
6 @property (nonatomic, retain) NSNumber * reps;
7 @property (nonatomic, retain) NSNumber * weight;
8 @property (nonatomic, retain) Exercise *belongsTo;
9
10 @end
Illegal interface qualifier
。Expected identifier or '('
。Unknown type name 'Exercise'
Property with 'retain (or strong)' attribute must be of object type
。@synthesize
或@dynamic
的属性(当然称之为)Exercise.h
1 @class ExerciseName, ExerciseSet, Workout, WorkoutMethod;
2
3 @interface Exercise : NSManagedObject
4
5 @property (nonatomic, retain) NSString * notes;
6 @property (nonatomic, retain) NSDecimalNumber * restBetweenSets;
7 @property (nonatomic, retain) NSNumber * rmMethod;
8 @property (nonatomic, retain) NSDecimalNumber * rmResult;
9 @property (nonatomic, retain) Workout *belongsTo;
10 @property (nonatomic, retain) NSSet *hasSet;
11 @property (nonatomic, retain) WorkoutMethod *isDoneWith;
12 @property (nonatomic, retain) ExerciseName *takesNameFrom;
13 @end
14
15 @interface Exercise (CoreDataGeneratedAccessors)
16
17 - (void)addHasSetObject:(ExerciseSet *)value;
18 - (void)removeHasSetObject:(ExerciseSet *)value;
19 - (void)addHasSet:(NSSet *)values;
20 - (void)removeHasSet:(NSSet *)values;
21 @end
Illegal interface qualifier
。Missing @end
。Unknown type name 'Workout'
。其他前向声明的接口没问题,没有任何问题或错误。
什么可能导致这种行为?
答案 0 :(得分:1)
我遇到了同样的问题,原来我的.h文件丢失了@end
这也是为什么重新生成NSManagedObjects的原因。
答案 1 :(得分:0)
你能在这里说明运动是如何定义的吗?你的代码似乎是正确的,但似乎你在练习
上有错误同时尝试更改
@class Exercise
有关:
#import "Exercise.h"
答案 2 :(得分:0)
我升级到Xcode 4.3,重新生成NSManagedObject
子类,错误消失了。它一定是Xcode中的一个错误。
谢谢你的帮助!