ios - 为什么 Xcode 9 默认更改我的 socket unsafe_unretained

标签 ios objective-c xcode

当我从 xib 控制拖动导出时,默认情况下我得到了 unsafe_unretained 属性。我正在使用 Xcode 9.1。以下代码是它的样子。

@property (unsafe_unretained, nonatomic) IBOutlet UILabel *shIndexLabel;

最佳答案

__unsafe_unretained specifies a reference that does not keep the referenced object alive and is not set to nil when there are no strong references to the object. If the object it references is deallocated, the pointer is left dangling.



以上摘自 Apple 文档。所以回答你的问题为什么 ?

It is not possible for the Swift compiler to know if these references are really intended to be strong (+1) or unretained (+0)



此更改涉及到 swift 编译器。他们制作了 __unsafe_unretained 默认情况下。

关于ios - 为什么 Xcode 9 默认更改我的 socket unsafe_unretained,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47344664/

相关文章:

ios - 为什么 initWithScheme 初始化的 NSURL 中有尾部斜杠...?

ios - 本地化所有语言的应用商店名称

ios - Swift 应用程序的启动顺序

objective-c - 初始化由 nswindowcontroller 隐式调用的 nsviewcontroller

ios - UICollectionview删除项目重排怪异动画

ios - 如何检测 UIWebView 何时完全完成加载?

xcode 提交丢失的文件或目录

ios - swift4 中 Core Data 的单元测试用例

ios - 检测文件流已完成并准备好使用 avplayer 播放

ios - NSPredicate 根据在关系中找到的计数获取