CoreAnimation warning deleted thread with uncommitted CATransaction

前端 未结 3 775
深忆病人
深忆病人 2020-12-24 07:04

I am having issues with the following warning:

CoreAnimation: warning, deleted thread with uncommitted CATransaction; set CA_DEBUG_TRANSACTIONS=1 in environment to l

3条回答
  •  Happy的楠姐
    2020-12-24 07:26

    Another way of ensuring any UI drawing occurs on the main thread, as described by Numist, 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:)
                               withObject:myCustomData
                            waitUntilDone:YES];
    
        [...]
    }
    
    - (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?

提交回复
热议问题