1
我有下面的代碼來更新我的對象是已在服務器上更改:解析固定的對象不更新
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[PFCloud callFunctionInBackground:@"getAllData" withParameters:@{@"LastUpdate": [self getLastSyncDate], @"Scan": @"NO"} block:^(NSArray *result, NSError *error){
if (!error) {
for (int x = 0; x < result.count; x++) {
PFObject *object = [result objectAtIndex:x];
[object unpinInBackgroundWithName:object.parseClassName block:^(BOOL succeeded, NSError *error){
if (!error) {
if ([object[@"deleted"] boolValue] != YES) {
[object pinInBackgroundWithName:object.parseClassName block:^(BOOL succeeded, NSError *error){
if (x == result.count - 1) {
[self performSelector:@selector(reloadTableView) withObject:nil afterDelay:0.3];
}
}];
}
}
}];
}
[defaults setObject:[NSDate date] forKey:@"LastSynced"];
[defaults synchronize];
}
[self reloadTableView];
}];
但我的對象不更新。從本地數據存儲調用PFQuery可以顯示舊版本。
有什麼想法?
你做到了,非常感謝! – Yoko
高興地幫助:) –