1

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?

Alex Stone
  • 46,408
  • 55
  • 231
  • 407

1 Answers1

4

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.

Community
  • 1
  • 1
gskspurs
  • 186
  • 1
  • 11