Difference between weak references in a block and a NSTimer

Viewed 562

As we know we need to use a weak reference inside a block to break the retain cycle, like so:

__weak id weakSelf = self;
[self doSomethingWithABlock:^() {
    [weakSelf doAnotherThing];
}]

However weak references can not break the retain cycle caused by a NSTimer.

__weak id weakSelf = self;
timer = [NSTimer scheduledTimerWithTimeInterval:30.0f 
                                         target:weakSelf
                                       selector:@selector(tick) 
                                       userInfo:nil
                                        repeats:YES]; // No luck

What's the difference? How can the timer still retain the target?

1 Answers
Related