warnParseOperationOnMainThread

warnParseOperationOnMainThread

本文介绍了正在主线程上执行长时间运行的Parse操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到错误:

我无法在我的代码中找到错误。有人可以告诉我我做错了什么吗?

I'm unable to locate the error within my code. Can someone please tell me what I'm doing wrong?

PFQuery *query = [PFQuery queryWithClassName:@"User"];
[query getObjectInBackgroundWithId:[[PFUser currentUser] objectId] block:^(PFObject *object, NSError *error) {

    self.firstName = object[@"firstname"];
    self.lastName = object[@"lastname"];

    self.nameLabel.text = [[NSArray arrayWithObjects:self.firstName, self.lastName, nil] componentsJoinedByString:@" "];
}];


推荐答案

这对发展商来说是一个温和的警告Parse调用会阻塞主线程。

This is a gentle warning to the developers when they make the Parse calls that would block the main thread.

这是你可以看到它发生的全部,在<$上添加符号断点 c $ c> warnBlockingOperationOnMainThread 仅当您使用2015年以上发布的Parse API时。否则,将它放在 warnParseOperationOnMainThread 上。

This is where you can see it all happen,, add a symbolic breakpoint on warnBlockingOperationOnMainThread only if you use a Parse API released from 2015+. Otherwise, put it on the warnParseOperationOnMainThread.

在运行代码时它会破坏该函数,并将显示一个堆栈跟踪,它可以帮助您找到阻止功能。

It'll break on that function while you are running your code, and will show you a stack trace which should help you to find the blocking function.

请参阅下面的图片以便更好地理解。

See the images below to have a better understanding.

这篇关于正在主线程上执行长时间运行的Parse操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-28 03:42