ARC下的NSString属性应该是强还是复制?

编程入门 行业动态 更新时间:2024-10-20 17:17:58
本文介绍了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属性应该是强还是复制?

本文发布于:2023-11-15 21:26:05,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1598092.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:应该是   属性   ARC   NSString

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!