溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

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

發(fā)布時間:2020-08-22 05:55:18 來源:網(wǎng)絡(luò) 閱讀:458 作者:midWander 欄目:開發(fā)技術(shù)


在練習(xí)Obect-C點語法的時候:

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


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


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


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

在使用析構(gòu)函數(shù)的時候[super dealloc]編譯不通過也一并解決。


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


-----end


向AI問一下細節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI