我有如下代码:
@interface InterfaceWithACategory () {
... Some variables
}
@end
在 XCode 4.0.2 中编译时效果很好
现在我对 XCode 4.2 + iOS SDK 5.0 进行了升级(已经为这个愚蠢的想法责备自己)并且出现错误“预期标识符或 '(' 在 '{' 标记之前”。
任何帮助将非常感激。
我有如下代码:
@interface InterfaceWithACategory () {
... Some variables
}
@end
在 XCode 4.0.2 中编译时效果很好
现在我对 XCode 4.2 + iOS SDK 5.0 进行了升级(已经为这个愚蠢的想法责备自己)并且出现错误“预期标识符或 '(' 在 '{' 标记之前”。
任何帮助将非常感激。
通常您不能在类扩展上创建 iVar,但是您可以使用 @property 语法设置声明的属性。
@interface InterfaceWithACategory ()
@property (retain) NSArray *inDisArray;
@property (retain) NSInteger iThinkYouGetInt;
@end
但是在 ObjC 2.1 中你可以这样做,但是将你的编译器设置为Apple LLVM 3.0我在 Xcode 4.2 + iOS5.0 上测试了它并且它可以工作。