xcode 編譯時遇到錯誤Existing ivar ’xxx‘ for unsafe_unretained property


在練習Obect-C點語法的時候:

//聲明:
int age;
NSString *address;
@property int age;
@property NSString *address;
//------
//實現:
@synthesize age;//編譯器通過
@synthesize address;//編譯器提示錯誤:
//Existing ivar 'address' for unsafe_unretained property ''address' mustbe_unsafe_unretained


在XCode 4.2中,Cocoa項目默認啓用了ARC(Automatic Reference Counting 自動引用計數 )。ARC據說是個“auto-magically”的功能,只是第三方支持不好~


115648651.jpg


將Object-C Automatic Reference Co... 改爲No 就通過了。

在使用析構函數的時候[super dealloc]編譯不通過也一併解決。


參考地址:http://book.douban.com/people/rockdragon/annotation/6392055/


-----end


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章