A long-running operation is being executed on the main thread warning on regular Parse functions

前端 未结 1 1968
鱼传尺愫
鱼传尺愫 2021-02-05 15:17

First of all, I know what this means. The problem is that I\'m getting this error on standard calls that can\'t be converted to background calls. I\'m getting this erro

1条回答
  •  情书的邮戳
    2021-02-05 16:10

    Wrap the calls in...

    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
        PFInstallation *currentInstallation = [PFInstallation currentInstallation];
    
            dispatch_async(dispatch_get_main_queue(), ^(void){
                // any UI updates need to happen in here back on the main thread
            });
    })
    

    and you will no longer see the warnings.

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