xcode ARC 的@property 定义:现在是强默认值吗?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9773604/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 23:42:31  来源:igfitidea点击:

@property definitions with ARC: Is strong default now?

iosxcodeautomatic-ref-counting

提问by trapper

Just running the ARC refactoring tool on the new xcode 4.3.1 and noticed that my (nonatomic, retain) properties are being swapped out for just (nonatomic) instead of (nonatomic, strong) like in the previous xcode.

刚刚在新的 xcode 4.3.1 上运行 ARC 重构工具,并注意到我的(非原子,保留)属性被替换为(非原子)而不是像之前的 xcode 中的(非原子,强)。

My code seems to run fine after this change so I am assuming that it is defaulting to strong anyway, anyone know why things have changed with the ARC converter?

在此更改后,我的代码似乎运行良好,因此我假设它无论如何都默认为强,有人知道为什么 ARC 转换器发生了变化吗?

回答by rickster

Yes, strongis the default in Xcode 4.3 and later. It's documented both in the LLVM docsand in Apple's guides to using propertiesand working with ARC.

是的,strong是 Xcode 4.3 及更高版本的默认设置。它在LLVM 文档和 Apple 的使用属性使用 ARC的指南中都有记录

回答by Aks

When the property is a basic type, the default value is assign, when the property is a object type, the default value is strong

当属性为基本类型时,默认值为assign,当属性为对象类型时,默认值为strong