title: UIView layer's animationForKey: is always nil
body: <p>I have a rather curious problem.</p>
  
  <p>I have a view that I'm animating with a <code>CAKeyframeAnimation</code>. The animation works as expected however, once the delegate's <code>animationDidStop:finished</code> method is fired, the layer associated with the view always returns <code>nil</code> when checked with the layer's <code>animationForKey:</code> method.</p>
  
  <p>Here's an illustration of the problem:</p>
  
  <pre><code>// This is in the view controller
  - (void) doAnimation:(id)sender {
      CAKeyframeAnimation *positionAnimation = [CAKeyframeAnimation animationWithKeyPath:@"position"];
  
      [positionAnimation setValues:arrayOfPoint];
      [positionAnimation setDuration:0.5];
      // ViewController is the delegate and has the animationDidStop:finished: method
      positionAnimation.delegate = self;
      [positionAnimation setValue:@"I am Text" forKeyPath:@"positionAnimation"];
  
      [someView.layer addAnimation:positionAnimation forKey:@"positionAnimation"];
      someView.layer.position = newPosition;
  }
  </code></pre>
  
  <p>Elsewhere in the controller, I have the <code>animationDidStop:finished:</code> method defined as follows:</p>
  
  <pre><code>- (void) animationDidStop:(CAAnimation *)anim finished:(BOOL)flag {
  
          NSArray *array = [someView.layer animationKeys];
          NSString *stringValue = [anim valueForKey:@"positionAnimation"];
  
          NSLog(@"valueForKey: %@", stringValue);
          // Prints 'I am Text'
  
          if(anim == [someView.layer animationForKey:@"positionAnimation"]) {
              //THIS NEVER GET CALLED
          }
  }
  </code></pre>
  
  <p>Why does the if block never evaluate to True? Why is <code>[someView.layer animationForKey:@"positionAnimation"]</code> always <code>nil</code>? Additionally, <code>stringValue</code> has the correct data, but array is also <code>nil</code>.</p>