ios - 局部变量默认为强还是弱?

标签 ios objective-c automatic-ref-counting

假设我有局部变量(不是属性)Obj *x = d,d 的引用计数是否递增?还是默认为弱引用?

最佳答案

Apple 的文档(Variable Qualifiers 部分)说:

https://developer.apple.com/library/ios/releasenotes/ObjectiveC/RN-TransitioningToARC/Introduction/Introduction.html

__strong is the default. An object remains “alive” as long as there is a strong pointer to it.

关于ios - 局部变量默认为强还是弱?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31682334/

相关文章:

ios - iOS 是否支持可跨越的字符串?

ios - Metal Compute 内核尺度图像

ios - 来自 NSString 的 NSJSONSerialization

objective-c - 以编程方式检测对象层次结构中的保留周期的策略可能是什么?

ios - 从NSMutableArray移除NSString

ios - 在 UIWebView 中全屏时如何拦截视频?

iphone - 如何使用 GCD 在主线程上延迟后安全地分派(dispatch)代码?

ios - Objective-C:如何从 UITableViewCell 播放视频?

ios - 使用 ARC 编码和解码 CGMutablePathRef

iphone - 即使使用 ARC,SKProductsRequest 仍被释放?