ARC forbids Objective-C objects in structs or unions despite marking the file -fno-objc-arc(尽管标记了文件 -fno-objc-arc,但 ARC 禁止在结构或联合中使用 Objective-C 对象)
问题描述
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 对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:尽管标记了文件 -fno-objc-arc,但 ARC 禁止在结构或
基础教程推荐
- 新的@SystemApi 注解是什么意思,和@hide 有什么区别 2022-01-01
- 可可/目标C(OSX不是iOS)从子对象访问父对象 2022-01-01
- 我的 UIImageView 的任务 2022-01-01
- 在 appComponent dagger 2 中动态添加测试模块? 2022-01-01
- 突出显示朗读文本(在 iPhone 的故事书类型应用程序中) 2022-01-01
- Android:STATE_SELECTED不工作 2022-01-01
- 在 iOS8 中无法获得正确的键盘高度值 2022-01-01
- - (CGRect)convertRect:(CGRect)rect toView:(UIView *)view 如何工作 2022-01-01
- 在 Android 模拟器中激活网络位置提供程序? 2022-01-01
- 如何将多个组件添加到 PickerView? 2022-01-01
