Search code examples
objective-cxcodecocoa-touchsynthesize

@synthesize not showing up for the auto generated properties in Xcode 4.5


I am having Xcode 4.5. I have observed a very strange behavior.In previous versions of Xcode whenever I control drag the outlets from the nib to .h files, it used to generate getters and setters automatically and @synthesize property clearly shows up in .m file . However if I do the same thing in Xcode 4.5 , @synthesize property doesn't show up. As a result , when I try to run my project created using Xcode 4.5 in Xcode 4.3 or less, it shows the error. When I manually write @synthesize , it works perfectly fine . Any help is greatly appreciated.


Solution

  • You no longer need to @synthesize properties, this is added during compile time to your code by the compiler.

    This is a new feature in the latest improvements of the compiler by Apple.

    You can @synthesize if you want, it will just take that bit longer and have extra lines of code. By default a property named myProperty, will have automatically an iVar named _myProperty.