Question

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.

Was it helpful?

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.

OTHER TIPS

Xcode 4.5 contains a newer version of clang, the compiler, that is capable of automatically synthesizing properties. So your observation is expected behavior. If you want to add the @synthesize directives you have to do this manually or use an older version of Xcode.

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