-1

Possible Duplicate:
self.prop=nil; vs. [prop release];prop=nil;

Can anyone help, What is the difference between [foo release] and self.foo = nil;?

Community
  • 1
  • 1
Vijay
  • 420
  • 6
  • 18
  • 3
    This has been covered a million times. It has to do with how the properties (keyword) are synthesized, if at all. –  Jan 17 '12 at 00:59
  • http://stackoverflow.com/questions/3702609/self-prop-nil-vs-prop-releaseprop-nil , http://stackoverflow.com/questions/4212628/whats-the-difference-between-setting-an-object-to-nil-vs-sending-it-a-release , http://stackoverflow.com/questions/6091394/is-setting-a-property-to-nil-same-as-releasing-the-property –  Jan 17 '12 at 01:01
  • The former releases the object address by foo. The latter does than and also sets the pointer to foo to nil. I've come to prefer the latter, even in dealoc routines. – Hot Licks Jan 17 '12 at 01:12

1 Answers1

0

here is some nice tutorial and explanation about it. It's simple, really.

http://www.raywenderlich.com/2712/using-properties-in-objective-c-tutorial

X Slash
  • 4,133
  • 4
  • 27
  • 35