Some examples of iOS code
Example how to create zombie object and let application crash on accessing it. There are 2 viewControllers. In scViewController we create 2 objects - holder and zombie. Holder only stores zombie object. After that we switch to second controller with holder object.
Now let's try to change line 15 in scHolder.h (@property (assign, nonatomic) scZombie *zombie;)
- @property (strong, nonatomic) scZombie *zombie; - everything is OK. Zombie speaks
- @property (weak, nonatomic) scZombie *zombie; Zombie is allready deallocated, but weak pointer nills it. So speak does nothing
- @property (assign, nonatomic) scZombie *zombie; Zombie is deallocated and aplication crashes. See the diference with nszombieenabled on/off