如何在 iOS 中声明一个 weakSelf 对象
How to declare a weakSelf object in iOS
有什么区别:
__weak __typeof(&*self)weakSelf = self
和
__weak __typeof(self)weakSelf = self
有人知道吗?
使用0xced的回答:
In the latest clang version Apple clang version 4.0
(tags/Apple/clang-421.1.48) (based on LLVM 3.1svn), i.e. Xcode 4.4+,
the __typeof__((__typeof__(self))self)
trick is not necessary
anymore. The __weak typeof(self) bself = self;
line will compile
just fine.
有什么区别:
__weak __typeof(&*self)weakSelf = self
和
__weak __typeof(self)weakSelf = self
有人知道吗?
使用0xced的回答:
In the latest clang version Apple clang version 4.0 (tags/Apple/clang-421.1.48) (based on LLVM 3.1svn), i.e. Xcode 4.4+, the
__typeof__((__typeof__(self))self)
trick is not necessary anymore. The__weak typeof(self) bself = self;
line will compile just fine.