App blocks while dipatching a queue

前端 未结 2 1021
情话喂你
情话喂你 2020-12-22 07:52

Im using XMPPFramework and in it\'s code there\'s a method like this:

- (NSDictionary *)occupants
{
    if (dispatch_get_current_queue() == moduleQueue)
             


        
相关标签:
2条回答
  • 2020-12-22 08:02

    The behavior you explain perfectly matches with the one that appears when you try to send perform an operation on main thread via GCD while being on the main thread. So you should check if moduleQueue is the main queue, then this is it. Try checking if it is the main queue if it is, skip the dispatch_sync block.

    0 讨论(0)
  • 2020-12-22 08:07

    Blocks sometimes need to retain variables to ensure they are available when they execute. If you use a local variable inside a block, you should initialise it to zero where you declare it outside the block.

    0 讨论(0)
提交回复
热议问题