Search code examples
cocoa-touchios4uiviewcore-animation

+animateWithDuration:animations:completion: crashes under simulator


Update

I too am experiencing the same issue, calls to +animateWithDuration:animations:completion: work fine on the device but crash on the simulator.

[UIView animateWithDuration:0.5 
                 animations:^{
                     NSLog(@"Begin");
                 }
                 completion:^(BOOL finished){
                     NSLog(@"End");
                 }];

As you can see I am not accessing any other objects and it will still crash with EXC_BAD_ACCESS.

Update 2

It seems to only crash if you pass a block in completion: passing NULL works fine.

[UIView animateWithDuration:0.5 
                 animations:^{
                     NSLog(@"Begin");
                 }
                 completion:NULL];

Original Question

I've been using the phone for development mostly because I was using a library that was not compiled for Intel but have now switched back to the simulator to speed things up.

I'm getting consistient crashes when I use UIView animateWithDuration and have had to comment them out temporarily in my code. They work fine on the phone. I'm on the latest SDK 4.3.1 (almost) and compiling for 4.0 onwards.

Any ideas why this is crashing?

    [UIView animateWithDuration:0.5 animations:^ {
    mapTableOverlay.alpha = 0.8;} completion:^(BOOL finished){}];

Getting EXC_BAD_ACCESS when the line above is called. Thanks for help....


Solution

  • This isn't exactly an answer, though it does outline what caused the problem, & what might alleviate it - I had exactly the same problem, all of a sudden any UIView animateWithDuration would crash, even if no objects were passed and even without the block on completion. It started when I added the Urban Airship libraries & associated frameworks (libUAirship-1.1.0.a, FNetwork.framework, MobileCoreServices.framework, Security.framework, SystemConfiguration.framework, libz.dylib, libsqlite3.dylib, CoreTelephony.framework, StoreKit.framework) and promptly stopped when I got rid of them again. I know it's nothing to do with the sqlite lib & the storeKit framework cos I'm using them now, but I never tracked it down properly. I'd be grateful for a more thorough answer too!