title: ARC capturing self... block inside a block and reference being released before execution
body: <p>I have this problem: a block inside a block.</p>
  
  <pre><code>  self.createStuff = ^ (NSString *text) {       
          self.post.onCompletion = ^(NSURLResponse *response, NSData *data, NSError *error){
                  [self doStuff];  // error here
          };
          [self doMoreStuff];  // error here
    };
  </code></pre>
  
  <p>I will have errors in [self doStuff] and on [self doMoreStuff]. The error is <strong>capturing 'self' strongly in this block is likely to lead to a retain cycle</strong></p>
  
  <p>Easy you say, just add</p>
  
  <pre><code>id mySelf = self; 
  </code></pre>
  
  <p>before the first block and use mySelf instead.</p>
  
  <p>Nope. This will not save my problem, simply because mySelf being of kind id will not give me a post property, needed by the second line. So I need to declare it like</p>
  
  <pre><code>MyClass *mySelf = self;
  </code></pre>
  
  <p>Making it like:</p>
  
  <pre><code>MyClass *mySelf = self;
  
    self.createStuff = ^ (NSString *text) {       
          mySelf.post.onCompletion = ^(NSURLResponse *response, NSData *data, NSError *error){
                  [self doStuff];  // error here
          };
          [mySelf doMoreStuff];  
    };
  </code></pre>
  
  <p>OK, you say, now the self.post.onCompletion line and doMoreStuff are not complaining anymore, but we have another self inside onCompletion... because this is a block inside a block. I can repeat the process creating another weak reference like and this will have to be a weak reference to a weak reference</p>
  
  <pre><code>MyClass *internalMyself = mySelf;
  </code></pre>
  
  <p>and use</p>
  
  <pre><code>   [internalMyself doStuff];
  </code></pre>
  
  <p>this seems to me to be a pretty pathetic way to do this and more, the app hangs when this method runs. Something like the reference is being deallocated before the method executes...</p>
  
  <p>How do I solve this charade?</p>
  
  <p>thanks.</p>
  
  <hr>
  
  <p>note: this is being compiled to iOS 6+</p>