美文网首页iOS学习小集iOS学习开发iOS
Xcode 7.3 Cannot create __weak r

Xcode 7.3 Cannot create __weak r

作者: keep_moving | 来源:发表于2016-03-31 21:04 被阅读3326次

    更新Xcode 7.3后编译可能会出现这个错:cannot create __weak reference in file using manual reference counting
    解决方法:

    1.可以设置build setting -> Apple LLVM7.1 - Language - Objective C -> Weak References in Manual Retain Release YES

    1.png
    2.用 __unsafe_unretained 代替 __weak,但是如果用 __unsafe_unretained请注意下面的问题。
    __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.

    Answer from Apple:
    This issue behaves as intended based on the following: We are in the process of implementing weak references in all Objective-C language modes. Since “__weak” has historically been ignored in non-ARC (and non-GC) language modes, we’ve added this error to point out places where the semantics will change in the future. Please update your bug report to let us know if this is still an issue for you.

    原文链接:http://keepmovingxin.com/archives/36

    相关文章

      网友评论

      • Twenty_:我是这么解决的 在iOS Deployment Target 把版本号到 iOS7.0
        keep_moving:@二零壹四年的天空有星星 接入了一个海外的SDK 只支持iOS 8.0以上😂

      本文标题:Xcode 7.3 Cannot create __weak r

      本文链接:https://www.haomeiwen.com/subject/fpaelttx.html