Search code examples
ioscocoa-touchcore-animation

Could someone explain 'CoreAnimation: timed out fence' log message?


I received a report of a crash with our iPad application, with a log message attached. The last couple of lines of the log message are as follows:

Aug 21 08:58:51 2TesterPad backboardd[26] <Warning>: CoreAnimation: timed out fence 25993
Aug 21 08:58:51 2TesterPad backboardd[26] <Warning>: CoreAnimation: updates deferred for too long
Aug 21 08:58:52 2TesterPad AppName[2428] <Warning>: CoreAnimation: failed to receive fence reply: 10004003

Can anyone tell me what these log messages mean please? I've been unable to find any good information about this online.


Solution

  • It typically means that core animation operations are queued, but have been pending for too long and have timed out.

    A few things to check:

    • Ensure you are calling the super method on any -viewDidAppear and -viewWillAppear
    • Ensure you are not performing animations before the view is presented via -viewDidAppear
    • Check you are only interacting with the UI on the main thread. I've seen issues with wait fence message when displaying a UIAlertView when the relevant code was executed on a background thread. You can make sure by putting your code in a block and sending it to the main thread, example below
    • This can happen if you have a UIScollView that has a lot of subviews and you animate the UIScrollView. In this case it will animate all of its subviews, even if those subviews aren't on screen. See this answer: https://stackoverflow.com/a/10938889/257550 . One solution to fix this would be to redesign the view to use a UITableView which ensures that only the subviews in the visible cells are animated.

      dispatch_async(dispatch_get_main_queue(), ^{
      
          UIAlertView *alert = 
             [[UIAlertView alloc] initWithTitle:@"title", 
                                         mssage:@"message"
                                       delegate:nil 
                              cancelButtonTitle:@"OK"
                              otherButtonTitles:nil];
      
          [alert show];
      });