Albert Català Albert Català - 1 year ago 149
iOS Question

How to avoid "CoreAnimation warning deleted thread with uncommitted CATransaction" if NOT using CoreAnimation

Just in the appdelegates, applicationDidBecomeActive. I create and start a thread, this thread waits an asynchronous download and then save data:

- (void)applicationDidBecomeActive:(UIApplication *)application
// begins Asynchronous download data (1 second):
[wsDataComponents updatePreparedData:NO];

NSThread* downloadThread = [[NSThread alloc]
selector: @selector (waitingFirstConnection)
[downloadThread start];



while (waitingFirstDownload) {
// Do nothing ... Waiting a asynchronous download, Observers tell me when
// finish first donwload

// begins Synchronous download, and save data (20 secons)
[wsDataComponents updatePreparedData:YES];

// Maybe is this the problem ?? I change a label in main view controller
[menuViewController.labelBadgeVideo setText:@"123 videos"];

// Nothig else, finish and this thread is destroyed

In the Organizer console, when finished, I am getting this warning:

CoreAnimation: warning, deleted thread with uncommitted CATransaction;

Answer Source

Another way of ensuring any UI drawing occurs on the main thread, as described by Andrew, is using the method performSelectorOnMainThread:withObject:waitUntilDone: or alternatively performSelectorOnMainThread:withObject:waitUntilDone:modes:

- (void) someMethod

    // Perform all drawing/UI updates on the main thread.
    [self performSelectorOnMainThread:@selector(myCustomDrawing:)


- (void) myCustomDrawing:(id)myCustomData
    // Perform any drawing/UI updates here.

For a related post on the difference between dispatch_async() and performSelectorOnMainThread:withObjects:waitUntilDone: see Whats the difference between performSelectorOnMainThread and dispatch_async on main queue?

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download