主线程正在执行长时间运行的常规Parse函数警告

首先,我知道这是什么意思。 问题是,我得到这个错误标准调用不能转换为后台调用。 我得到这个错误的应用程序开始于:

[Parse enableLocalDatastore];

PFInstallation *currentInstallation = [PFInstallation currentInstallation];

我发现这些方法是通过在warnParseOperationOnMainThread上设置一个符号断点并检查调用堆栈而导致麻烦的。

我不能用asynchronous代码来replace这些调用,而据我所知,这些方法要定期从主线程调用。 这是一个parsing错误,或者我应该从后台线程调用所有这些方法?

将呼叫包裹在…

 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 }); }) 

你将不再看到警告。