[英]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.