ARC下的NSString属性应该是强还是复制? [英] Should an NSString property under ARC be strong or copy?
本文介绍了ARC下的NSString属性应该是强还是复制?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当不使用ARC编译时,建议对 NSString
之类的数据类型使用 copy
属性。我找不到在ARC模式下使用 copy
的正确文档。有人能告诉我什么适用于ARC?
When not compiling with ARC, it is recommended to use copy
properties for data types such as NSString
. I could not find proper documentation on the use of copy
in ARC mode. Can someone tell me what's applicable for ARC?
推荐答案
它仍然建议复制,因为你想避免一些通过可变字符串,然后更改它而不知道。复制保证您所拥有的字符串不会改变。
It is still recommended to copy because you want to avoid something passing a mutable string and then changing it without you knowing. A copy guarantees that the string you have will not change.
这篇关于ARC下的NSString属性应该是强还是复制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文