Last active
January 25, 2018 05:33
-
-
Save el-hoshino/59ba3018ac7289ea6593d024dfdc5a59 to your computer and use it in GitHub Desktop.
【バグ】NSObject を継承したオブジェクトを unowned プロパティーとして保持すると、それを保持しているインスタンスを print すると落ちる ref: https://qiita.com/lovee/items/56555e3c7cf880a44efd
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Foundation | |
| class C: NSObject { | |
| } | |
| struct D { | |
| unowned let x: C | |
| } | |
| let c = C() | |
| let d = D(x: c) // Playground ではここで落ちる | |
| print(d) // シミュレーターや実機ではここで落ちる |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment