ARC forbids Objective-C objects in structs or unions despite marking the file -fno-objc-arc

后端 未结 4 1380
暖寄归人
暖寄归人 2020-11-29 00:43

ARC forbids Objective-C objects in structs or unions despite marking the file -fno-objc-arc? Why is this so?

I had the assumption that if you mark it -fno-objc-arc y

4条回答
  •  青春惊慌失措
    2020-11-29 01:21

    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;
    

    to

    typedef struct OFBragDelegateStrings
    {
         __unsafe_unretained NSString* prepopulatedText;
         __unsafe_unretained NSString* originalMessage;
    } OFBragDelegateStrings;
    

提交回复
热议问题