Ezra
Ezra

Reputation: 670

How to declare a weakSelf object in iOS

What's the difference between:

__weak __typeof(&*self)weakSelf = self

and

__weak __typeof(self)weakSelf = self

anyone know this?

Upvotes: 1

Views: 175

Answers (1)

TianGeng
TianGeng

Reputation: 64

Use 0xced's answer:

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.

https://stackoverflow.com/a/11226768/630195

Upvotes: 2

Related Questions