2012-03-06 90 views
0

我有我的生成的模型對象一噸的錯誤:Xcode中產生的NSManagedObject子類錯誤

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 1.
  • 第3行Expected identifier or '('在線8
  • Property with 'retain (or strong)' attribute must be of object type上線8
  • 警告所有屬性不調用@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第1行
  • Missing @end上面的第3行。
  • Unknown type name 'Workout'第9行。

對方前鋒聲明的接口都OK,沒有問題或錯誤。

什麼可能導致此行爲?

回答

0

我升級Xcode的4.3,再生的NSManagedObject小類錯誤消失了。它一定是Xcode中的一個bug。

感謝您的幫助!

0

你可以在這裏說明如何定義運動嗎?您的代碼看起來正確的,但你似乎對類運動

與此同時嘗試錯誤改變

@class Exercise 

爲:

#import "Exercise.h" 
+0

已編輯的問題。 – Gerstmann 2012-03-06 08:06:36

+0

嘗試刪除;在類 – 2012-03-06 08:11:19

+0

沒有工作,給出了預期的語法錯誤。 – Gerstmann 2012-03-06 08:14:46

1

我剛剛有同樣的問題,事實證明,我的一個.h文件丟失@end 這也是爲什麼重新生成NSManagedObjects的原因。