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

前端之家收集整理的这篇文章主要介绍了ios – 在正常Parse功能的主线程警告上执行长时间运行的操作前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
首先,我知道这是什么意思.问题是我在无法转换为后台调用的标准调用上收到此错误.我在应用程式开始时遇到这个错误: @H_301_2@[Parse enableLocalDatastore];

@H_301_2@PFInstallation * currentInstallation = [PFInstallation currentInstallation];

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

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

解决方法

将电话转入…
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
        });
})
@H_301_2@您将不再看到警告.

原文链接:https://www.f2er.com/iOS/337038.html

猜你在找的iOS相关文章