gpt4 book ai didi

ios - 解析 Hello World 警告 - 正在主线程上执行长时间运行的操作

转载 作者:行者123 更新时间:2023-11-29 02:06:14 32 4
gpt4 key购买 nike

我收到以下错误:

Warning: A long-running operation is being executed on the main thread. Break on warnBlockingOperationOnMainThread() to debug.

代码如下:

- (IBAction)createButtonClicked:(id)sender {
PFObject *demoObject = [PFObject objectWithClassName:
@"Demo"]; // 1
[demoObject setObject:@"data value" forKey:@"dataColumn"]; // 2
[demoObject save]; // 3
}

最佳答案

请尝试这种方式,

 PFObject * demoObject = [PFObject objectWithClassName:@"Demo"];
demoObject[@"dataColumn"] = @"data value";

[demoObject saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error)
{
// take any action after saving.
}];

关于ios - 解析 Hello World 警告 - 正在主线程上执行长时间运行的操作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29763462/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com