top | item 6770799

(no title)

ddustin | 12 years ago

This is the correct way to access ivars. Though it makes a lot of indents so I usually do a return. I also use __strong to be explicit to the reader.

__strong MyClass *strongSelf = weakSelf;

if(!strongSelf) return;

... Rest of block

It's also worth noting calling functions on weakSelf can in turn access ivars. Getting a strong reference to self solves both the issues. NSLog calls [self description] in your example.

discuss

order

No comments yet.