title: Dereferencing a __weak pointer is not allowed inside block
body: <p><a href="http://developer.apple.com/library/ios/#documentation/cocoa/conceptual/ProgrammingWithObjectiveC/WorkingwithBlocks/WorkingwithBlocks.html" rel="noreferrer">Apple docs</a> say I can avoid a strong reference cycle by capturing a weak reference to self, like this:</p>
  
  <pre><code>- (void)configureBlock {
      XYZBlockKeeper * __weak weakSelf = self;
      self.block = ^{
          [weakSelf doSomething];   // capture the weak reference
                                    // to avoid the reference cycle
      }
  }
  </code></pre>
  
  <p>Yet when I write this code, the compiler tells me:</p>
  
  <blockquote>
    <p>Dereferencing a __weak pointer is not allowed due to possible null
    value caused by race condition, assign it to strong variable first</p>
  </blockquote>
  
  <p>Yet doesn't the following code create a strong reference cycle, and possibly leak memory?</p>
  
  <pre><code>- (void)configureBlock {
      XYZBlockKeeper *strongSelf = self;
      self.block = ^{
          [strongSelf doSomething];
      }
  }
  </code></pre>