Does the syntax changed for class extensions?

226 views Asked by At

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.

2

There are 2 answers

0
pchap10k On BEST ANSWER

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.

1
d.lebedev On