我在加载和发送数据到parse.com时遇到了一些问题。
我想从解析用户类中读取一个数组,添加它并将其发送回parse.com。
以下代码显示了它如何适用于" normal"发送数组的类:
PFQuery *query = [PFQuery queryWithClassName:@"myOwnClass"];
[query getObjectInBackgroundWithId:@"myObjectID"
block:^(PFObject *gameScore, NSError *error) {
[gameScore addUniqueObjectsFromArray:@[@"Name1", @"Name1"] forKey:@"Friends"];
[gameScore saveInBackground]; }];
答案 0 :(得分:1)
获取数组...更改您的PFQuery方法:
-(void)FetchFromPFUserClass{
PFQuery*query = [PFUser query];
[query getObjectInBackgroundWithId:@"myObjectID"
block:^(PFObject *gameScore, NSError *error) {
if(error==nil){
[gameScore addUniqueObjectsFromArray:@[@"Name1", @"Name1"] forKey:@"Friends"];
[gameScore saveInBackground];
}
}];
}