Question

I had code like below:

@interface InterfaceWithACategory () {
    ... Some variables
}
@end

Which worked perfect when compiled in XCode 4.0.2

Now I did an upgrade (already blame myself for this stupid idea) to XCode 4.2 + iOS SDK 5.0 and have an error "Expected identifier or '(' before '{' token".

Any help would be really appreciated.

Was it helpful?

Solution

Normally you can't create iVars on a class extension, you can however set declared properties using the @property syntax.

@interface InterfaceWithACategory ()
@property (retain) NSArray *inDisArray;
@property (retain) NSInteger iThinkYouGetInt;
@end

However in ObjC 2.1 you can do this, but set your compiler to Apple LLVM 3.0 I tested this on Xcode 4.2 + iOS5.0 and it works.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top