@protocol声明中的Xcode“Parse issue”,“Unexpected type”

时间:2011-12-12 11:25:48

标签: objective-c xcode parsing xcode4.2 inappsettingskit

我最近将InAppSettingsKit添加到项目中(虽然我认为这不是IASK特定的。)

我正在使用Xcode 4.2,它给出了一个奇怪的错误:

 /Users/Username/Documents/ProjectName/a-branch/app-name/Code/InAppSettingsKit/Models/IASKSettingsStore.h:22:18: error: expected a type [1]
  - (void)setBool:(BOOL)value forKey:(NSString*)key;
                   ^ 1 error generated.  

Xcode "Parse issue", "Unexpected type" in @protocol declaration

如果我注释掉它就行了,它会构建好。

我已经尝试了所有常用的Xcode技巧,清理,重启,删除派生数据文件夹等。

1 个答案:

答案 0 :(得分:0)

这有效但我仍然想更多地理解错误:

- (void)setBool:(BOOL)value forKey:(NSString*)key;行移至底部。

@protocol IASKSettingsStore <NSObject>
@required
- (void)setBool:(BOOL)value forKey:(NSString*)key;
- (void)setFloat:(float)value    forKey:(NSString*)key;
- (void)setDouble:(double)value  forKey:(NSString*)key;
- (void)setInteger:(int)value    forKey:(NSString*)key;
- (void)setObject:(id)value      forKey:(NSString*)key;
- (BOOL)boolForKey:(NSString*)key;
- (float)floatForKey:(NSString*)key;
- (double)doubleForKey:(NSString*)key;
- (int)integerForKey:(NSString*)key;
- (id)objectForKey:(NSString*)key;
- (BOOL)synchronize; // Write settings to a permanant storage. Returns YES on success, NO otherwise
@end

这编译(????)

@protocol IASKSettingsStore <NSObject>
@required
- (void)setFloat:(float)value    forKey:(NSString*)key;
- (void)setDouble:(double)value  forKey:(NSString*)key;
- (void)setInteger:(int)value    forKey:(NSString*)key;
- (void)setObject:(id)value      forKey:(NSString*)key;
- (BOOL)boolForKey:(NSString*)key;
- (float)floatForKey:(NSString*)key;
- (double)doubleForKey:(NSString*)key;
- (int)integerForKey:(NSString*)key;
- (id)objectForKey:(NSString*)key;
- (BOOL)synchronize; // Write settings to a permanant storage. Returns YES on success, NO otherwise
- (void)setBool:(BOOL)value forKey:(NSString*)key;
@end