objective-c - ARC : strong or retain? 的@property 定

使用 Xcode 4.2 和 ARC,我注意到自动生成的 NSManagedObject 代码对于属性仍然是这样的:

@property (nonatomic, retain) NSString * someString;

1) 现在不应该将 retain 替换为 strongweak 吗?

2) 为什么自动生成的代码还是使用retain

3) 在此属性语句中,retain 的正确替换是什么?

我目前正在使用 NSFetchRequest 调试一个问题,我认为这可能是问题的根源。想法?

最佳答案

1) Shouldn't retain now be replace with strong or weak?

没有。你不能用弱替换保留;它们不一样。而strong是100%保留的同义词;它们是相同的。你可以使用任何一个,所以这里没有“应该”。如果你愿意,你可以用 strong 替换 retain,但你不是必须的。

2) Why does the auto-generated code still use retain

为什么不呢?见(1)。保留是正确的,所以没有问题。

3) What is the correct replacement for retain in this property statement?

不需要替换retain。

I'm currently debugging a problem using NSFetchRequest, and I thought this might be the source of the problem. Thoughts?

不是。

关于objective-c - ARC : strong or retain? 的@property 定义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7796476/

相关文章:

iphone - NSTimeInterval 到 HH :mm:ss?

iphone - 如何找到 malloc "double free"错误的原因?

objective-c - .h 和 .m 文件中的@interface 定义之间的区别

ios - 没有为应用商店上的应用程序找到有效的 'aps-environment' 权利字符串

objective-c - 我不想在开始更新、结束更新 block 中为 uitableview 设

objective-c - 标题中有两行文本的 UIButton (numberOfLines=2)

ios - 在自动布局中将 subview 的 X 居中抛出 "not prepared for t

objective-c - Objective-C中的ivars和属性有什么区别

iphone - 如何为 View 或图像沿弯曲路径的移动设置动画?

objective-c - 如何向 objc_exception_throw 添加断点?