Parse platform Parse.com saveinbackgroundithblock根本没有被调用
升级解析库后,saveInBackgroundWithBlock停止工作。请检查下面的代码,这以前可以用,但现在不行了。我做错什么了吗Parse platform Parse.com saveinbackgroundithblock根本没有被调用,parse-platform,Parse Platform,升级解析库后,saveInBackgroundWithBlock停止工作。请检查下面的代码,这以前可以用,但现在不行了。我做错什么了吗 PFQuery* query = [PFQuery queryWithClassName: @"FoodDaily"]; [query whereKey: @"user_id" equalTo: [[PFUser currentUser] objectId]]; [query whereKey: @"date" equalTo: [dicItem valueFo
PFQuery* query = [PFQuery queryWithClassName: @"FoodDaily"];
[query whereKey: @"user_id" equalTo: [[PFUser currentUser] objectId]];
[query whereKey: @"date" equalTo: [dicItem valueForKey: @"date"]];
m_loadingView.hidden = NO;
[query findObjectsInBackgroundWithBlock:^(NSArray *result, NSError *error)
{
if(error)
{
NSLog(@"error");
m_loadingView.hidden = YES;
[[AppDelegate getDelegate] showMessage: NETWORK_DISCONNECT_ERROR];
return;
}
if (!error) {
NSLog(@"result: %@", result);
m_loadingView.hidden = YES;
PFObject* objRecord = [PFObject objectWithClassName:@"FoodDaily"];
if ([result count]>0) {
objRecord = [result objectAtIndex: 0];
}
[objRecord setObject: [dicItem valueForKey: @"breakfast_food"] forKey: @"breakfast_food"];
m_loadingView.hidden = NO;
[objRecord saveInBackgroundWithBlock: ^(BOOL succeeded, NSError* error)
{
if(succeeded)
{
m_loadingView.hidden = YES;
NSLog(@"Success Updating New Food Daily Item");
[self.navigationController popToViewController: [AppDelegate getDelegate].m_viewFoodDaily animated: YES];
}
else
{
m_loadingView.hidden = YES;
[[AppDelegate getDelegate] showMessage: NETWORK_DISCONNECT_ERROR];
NSLog(@"Failed Saving New Food Item");
}
}];
}
}];
在日志中,我只得到
result: (
)
这是通过NSLog(@“结果:%@”,result)实现的;但是SaveInBackgroundithBlock中没有任何内容您的问题不在于SaveInBackgroundithBlock,而在于FindObjectsInBackgroundithBlock中的查询没有获取任何结果。请在prase UI上运行相同的查询,并检查您是否在那里得到任何结果