문제

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