本文介紹了盡管標記了文件 -fno-objc-arc,但 ARC 禁止在結構或聯合中使用 Objective-C 對象的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
限時送ChatGPT賬號..
ARC 禁止在結構或聯合中使用 Objective-C 對象,盡管標記了文件 -fno-objc-arc?為什么會這樣?
ARC forbids Objective-C objects in structs or unions despite marking the file -fno-objc-arc? Why is this so?
我假設如果你標記它 -fno-objc-arc 你沒有這個限制.
I had the assumption that if you mark it -fno-objc-arc you don't have this restriction.
推薦答案
如果您收到此消息,請嘗試 __unsafe_unretained.只有在結構中的對象未被保留時,它才是安全的.示例:如果您將 OpenFeint 與 ARC 一起使用,則 OFBragDelegateStrings 類會在結構中顯示此錯誤.
If you got this message try __unsafe_unretained. It is only safe, if the objects in the struct are unretained. Example: If you use OpenFeint with ARC the Class OFBragDelegateStrings says this error in a struct.
typedef struct OFBragDelegateStrings
{
NSString* prepopulatedText;
NSString* originalMessage;
} OFBragDelegateStrings;
到
typedef struct OFBragDelegateStrings
{
__unsafe_unretained NSString* prepopulatedText;
__unsafe_unretained NSString* originalMessage;
} OFBragDelegateStrings;
這篇關于盡管標記了文件 -fno-objc-arc,但 ARC 禁止在結構或聯合中使用 Objective-C 對象的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!