Reputation: 4383
Take this code :
@interface SomeClass:NSObject
{
@private
NSString* Size;
}
@property NSString* Size;
@end
--------------------------
@implementation SomeClass
@synthesize Size;
- (void) something
{
Size = @"syntax error : Expected identifier or '(' ";
self.Size = @"works ok";
}
@end
Why is this a syntax error? Is "Size" a reserved word or already defined in NSSObject ? I'm getting the error on two separate projects...
Upvotes: 2
Views: 106
Reputation: 3805
This is in MacTypes.h
typedef long Size;
It will cause a build error, I tested it in my own code.
Use objective C naming standards and you wont hit the conflict.
NSString *size;
Upvotes: 1
Reputation: 424
Did you option-Click or cmd+Click on Size (not self.Size)?
X Code should tell you that it is declared in MacTypes.h as typedef long Size;
Upvotes: 2
Reputation: 8105
Size is a type:
typedef long Size;
Dont use it, and you should follow the Objective-C conventions, which are to name the properties with lowerCase.
Upvotes: 8