title: Crash using [UIBezierPath CGPath] with CAShapeLayer under ARC
body: <p>I'm getting a BAD ACCESS error using <code>[UIBezierPath CGPath]</code> with <code>CAShapeLayer</code> under ARC. I've tried bridging in various ways but I'm not clear if that is the problem. I have isolated the crash to using the result of the <code>makeToPath</code> method:</p>
  
  <pre><code> maskLayer = [CAShapeLayer layer];
   maskLayer.path = [self makeToPath];
  </code></pre>
  
  <p>But this doesn't crash:</p>
  
  <pre><code> maskLayer = [CAShapeLayer layer];
   maskLayer.path = [self makeFromPath];
  </code></pre>
  
  <p>Is there something invalid with the path created by <code>makeToPath</code>? I'm planning to use the <em>from</em> and <em>to</em> paths with a <code>CABasicAnimation</code> once I sort this crash out. What is the correct ARC bridging for <code>CGPathRef</code>s from <code>UIBezierPath</code>?</p>
  
  <pre><code>-(CGPathRef)makeToPath
  {
      UIBezierPath* triangle = [UIBezierPath bezierPath];
      [triangle moveToPoint:CGPointZero];
      [triangle addLineToPoint:CGPointMake(self.view.frame.size.width,0)];
      [triangle addLineToPoint:CGPointMake(0, self.view.frame.size.height)];
      [triangle closePath];
      return [triangle CGPath];
  }
  
  -(CGPathRef)makeFromPath
  {
      UIBezierPath*rect = [UIBezierPath bezierPathWithRect:self.view.frame];
      return [rect CGPath];
  }
  </code></pre>
  
  <p><strong>UPDATE</strong> So I changed my .h file per an answer below but I am still getting the crash</p>
  
  <pre><code>-(CGPathRef)makeToPath CF_RETURNS_RETAINED;
  -(CGPathRef)makeFromPath CF_RETURNS_RETAINED;
  </code></pre>
  
  <p>I also tried making my methods return a <code>UIBezierPath</code> instance per the answer <a href="https://stackoverflow.com/a/14130159/840992">here</a> (shown below). Still no success. Anyone want to give me the longform explanation on how to fix this?</p>
  
  <pre><code>maskLayer.path = [[self makeToPath] CGPath];// CRASHES
  morph.toValue =  CFBridgingRelease([[self makeToPath] CGPath]);// CRASHES
  </code></pre>
  
  <hr>
  
  <pre><code>-(UIBezierPath*)makeToPath
  {
      UIBezierPath* triangle = [UIBezierPath bezierPath];
      [triangle moveToPoint:CGPointZero];
      [triangle addLineToPoint:CGPointMake(self.view.frame.size.width,0)];
      [triangle addLineToPoint:CGPointMake(0, self.view.frame.size.height)];
      [triangle closePath];
      return triangle;
  }
  </code></pre>