Differences between weak and unsafe_unretained

后端 未结 3 1857
小蘑菇
小蘑菇 2020-12-16 21:00

So I had a project that supported iOS 4, so all my IBOutlets were __unsafe_unretained even IBOutlets that were in the nib but outside the controllers main view

3条回答
  •  一整个雨季
    2020-12-16 22:06

    You are correct, the app will crash when trying to access deallocated objects through your stale __unsafe_unretained references.

    The reason it doesn't is very likely because the objects are being referenced by some other part of your app with strong references.

    Try running with zombies enabled, that should cause an immediate crash when dereferencing the presumedly stale pointers.

提交回复
热议问题