You need to either add [inv retainArguments] or change the waitUntilDone parameter to YES, but before you do this, let me just say that what you did is pretty unreadable.
What I would do is save any state that you need in the instance variables, and then when you are ready, just do:
[self performSelectorOnMainThread:@selector (startAnimation) withObject:nil waitUntilDone:NO];
Also, the allocation and initialization of CABasicAnimation in the stream is not required (it will not take any noticeable time for this in the main stream) and is still potentially dangerous. Keep your processor busy in a separate thread, but nothing more.
Chris suter
source share