문제

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.

도움이 되었습니까?

해결책

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.

다른 팁

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top