Do I need to check if weak self is nil in blocks?
I create weakSelf pointer like:
__weak typeof(self) weakSelf = self;
and in the b
It seems quite unnecessary since calling a message on nil is a no-op. (Nothing happens)
^{
[weakSelf doSomething]; //Does nothing if weakSelf is nil
}
The only reason I can think you might want to do this is if other messages (not on self) shouldn't be called
^{
// Here I don't want to add weakSelf as an observer if it's nil
if (!weakSelf) return;
[OtherClass addObserverForSomething:weakSelf];
}