Table of Content
The correct way to define a weak object is:
__typeof__(obj) __weak wobj = obj;
Note that having __weak
before the type is technically incorrect.
However, you can find this in AFNetworking
's AFURLConnectionOperation.m
codes:
__weak __typeof(&*self)weakSelf = self;
But the __typeof__((__typeof__(self))self)
trick is not necessary anymore in the clang version Apple clang version 4.0
and later, like Xcode 4.4
+.