Question

I've encountered several "message sent to deallocated instance" bugs within my app and traced them to the use of

@property(nonatomic,assign)NSObject* object;

Replacing them with

@property(nonatomic,weak)BuffCollection* buffCollection;

solves the problem. Should I define all of my properties where I don't want to use strong to be using weak instead of assign?

Was it helpful?

Solution

Theres a great explanation of all the different property attributes here.

If you are using ARC, the basics are to use strong for obj-c objects you want to retain, weak for obj-c objects you don't want to retain and assign for non-objective-c (so C) primatives. Strong is default.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top