我收到以下错误:


  警告:主机上正在执行长时间运行的操作
  线。中断warnBlockingOperationOnMainThread()进行调试。


代码如下:

- (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/

10-12 01:48