0

I am getting the warning during the analysing my application i am attaching the screen shot, i am getting Dead store value stored for animationForButton2 during its initialisation
is never read enter image description here

where the button_2 is the custom UIButton how can shut this warning .. ?

Shankar BS
  • 8,394
  • 6
  • 41
  • 53

1 Answers1

2

Just replace the lines that say:

CAKeyframeAnimation *animationForButton2 = [CAKeyframeAnimation animation];
animationForButton2 = [CAKeyframeAnimation animationWithKeyPath:@"position"];

With

CAKeyframeAnimation *animationForButton2 = [CAKeyframeAnimation animationWithKeyPath:@"position"];

In the original code sample, there's no point in instantiating animationForButton2 with a CAKeyframeAnimation, only to discard that and replace it with another CAKeyframeAnimation on the very next line.

Rob
  • 415,655
  • 72
  • 787
  • 1,044