[英]Xcode generated NSManagedObject subclass errors
我的生成的模型对象有很多错误:
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 '('
第3行上的Expected identifier or '('
。 Unknown type name 'Exercise'
Property with 'retain (or strong)' attribute must be of object type
第8行Property with 'retain (or strong)' attribute must be of object type
。 @synthesize
或@dynamic
(当然会调用它们) 运动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'
。 其他向前声明的接口都可以,没有问题或错误。
是什么导致这种现象?
我只是遇到了同样的问题,结果是我的.h文件之一丢失了@end
这也是为什么重新生成NSManagedObjects的原因。
您能在这里介绍如何定义锻炼吗? 您的代码似乎正确,但似乎在类练习中出错
同时尝试更改
@class Exercise
对于:
#import "Exercise.h"
我升级到Xcode 4.3,重新生成了NSManagedObject
子类,错误消失了。 它一定是Xcode中的错误。
无论如何,谢谢您的帮助!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.