ios – 在正常Parse功能的主线程警告上执行长时间运行的操作

首先,我知道这是什么意思.问题是我在无法转换为后台调用的标准调用上收到此错误.我在应用程式开始时遇到这个错误:

[Parse enableLocalDatastore];

PFInstallation * currentInstallation = [PFInstallation currentInstallation];

我发现这些方法通过在warnParseOperationOnMainThread上设置一个符号断点并检查调用堆栈来引起麻烦.

我不能用异步替换这些调用,据我所知,这些方法是从主线程定期调用的.这是一个解析错误,还是应该从后台线程调用所有这些方法?

解决方法

将电话转入…
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
        });
})

您将不再看到警告.

相关文章

当我们远离最新的 iOS 16 更新版本时,我们听到了困扰 Apple...
欧版/美版 特别说一下,美版选错了 可能会永久丧失4G,不过只...
一般在接外包的时候, 通常第三方需要安装你的app进行测...
前言为了让更多的人永远记住12月13日,各大厂都在这一天将应...