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?

有帮助吗?

解决方案

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top