Skip to content

Instantly share code, notes, and snippets.

@el-hoshino
Last active January 25, 2018 05:33
Show Gist options
  • Select an option

  • Save el-hoshino/59ba3018ac7289ea6593d024dfdc5a59 to your computer and use it in GitHub Desktop.

Select an option

Save el-hoshino/59ba3018ac7289ea6593d024dfdc5a59 to your computer and use it in GitHub Desktop.
【バグ】NSObject を継承したオブジェクトを unowned プロパティーとして保持すると、それを保持しているインスタンスを print すると落ちる ref: https://qiita.com/lovee/items/56555e3c7cf880a44efd
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