1
saveInBackgroundWithBlock在升級解析庫後停止工作。請檢查下面的代碼,這用於之前的工作,但不再。我在這裏做錯了什麼?Parse.com saveInBackgroundWithBlock根本沒有被調用
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(@ 「的結果:%@」,結果);但沒有saveInBackgroundWithBlock