2

Possible Duplicate:
using completion with animateWithDuration causes exc_bad_access

I am really confused here.

The following code works fine

[UIView animateWithDuration:0.4f 
    animations:^{
        flipView.layer.transform = CATransform3DMakeRotation(M_PI_2,1.0,0.0,0.0);
    } 
    completion:nil 
];

but this causes a EXEC_BAD_ACCESS error

[UIView animateWithDuration:0.4f
    animations:^{
        flipView.layer.transform = CATransform3DMakeRotation(M_PI_2,1.0,0.0,0.0);
    } 
    completion:^(BOOL finished) {} 
 ];

Any idea why this would be? I have tried creating a new project with just a view and the same issue is happening.

Community
  • 1
  • 1
JLamkin
  • 721
  • 6
  • 17
  • 1
    i dont want to seem mean or anything but with the console error and 5 min or search i found [this](http://stackoverflow.com/questions/5957826/using-completion-with-animatewithduration-causes-exc-bad-access) :) . Same problem as you. – skytz Apr 02 '12 at 21:50
  • I saw that earlier and tried it and it did not work. Went to double check now and realized I only removed it from the project and not the Target build settings. Thanks. – JLamkin Apr 02 '12 at 21:56

1 Answers1

-2

well insert something in the parentheses after (BOOL finished) because after the animation is over the method is trying to execute completion block..and doesn't find anything there to do..and it crashes

that's why it works with nil ..cuz it knows there is nothing more to do

skytz
  • 2,201
  • 2
  • 18
  • 23
  • Even when I try [UIView animateWithDuration:0.4f animations:^{flipView.layer.transform = CATransform3DMakeRotation(M_PI_2,1.0,0.0,0.0);} completion:^(BOOL finished){ NSLog(@"DONE");} ]; It still crashes. I have used this code before and worked fine, I think I may be stumbling across something really peculiar. – JLamkin Apr 02 '12 at 21:17
  • what is the error in console? – skytz Apr 02 '12 at 21:26
  • All it says is EXEC_BAD_ACCESS code=2 – JLamkin Apr 02 '12 at 21:41