objective c - Generic typeof for weak self references -


i trying figure out way use typeof create weak reference self use in blocks avoid retain cycles.

when first read seems convention use __block typeof(self) bself = self;, compiles using __block avoid retain cycles doesn't work anymore , __weak should used instead.

however __weak typeof(self) bself = self; results in error:

the type 'typeof (self)' (aka 'tuaccountsviewcontroller *const __strong') has retainment attributes set on it

is there way use typeof or call generically create weak reference self?

in latest clang version apple clang version 4.0 (tags/apple/clang-421.1.48) (based on llvm 3.1svn), i.e. xcode 4.4+, __typeof__((__typeof__(self))self) trick not necessary anymore. __weak typeof(self) bself = self; line compile fine.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -