A long time ago to see the source of the afnetworking to find such a sentence:
1 2 3 4 5 6 7 8 9 Ten |
//Do not know the use of this line of code of the students you should go to study the arc of attention and the use of block//Afnetworking __weak __typeof(&*self)weakself = self ; //I've been writing this before. __weak __typeof(self) weakself = Self ;//or write this __weak xxxviewcontroller *weakself = Self ;//or write this __weak ID weakself = self;
|
At that time did not notice why to write &* this appearance ... Think again today, search a lap, finally let me find the reason ...
Body
In fact, the above 4 kinds of writing are right
Afnetworking is not written in this line of code because typeof (self)
will be parsed into xxxviewcontroller *const __strong
(If your self is xxxviewcontroller), Then you will get an error ... (No old version, no validation, but look at the online conclusion should be like this)
However, if you write the __typeof (self), there is no problem ... That's because there's no such situation after LLVM3.1 ... (VIA)
A way of weakself