我在数据浏览器中有一个数组,它应该包含一个用户列表,这些用户已经从用户那里收到了一个项目。瓷砖的实际内容是
[{"__type":"Pointer","className":"_User","objectId":"3zQoMVRJOx"}]
我无法弄清楚如何从Xcode中实际调用,使用和显示这些数据。
我的最终目标是能够找到已发送项目的用户总数,因此这就是我需要来自阵列的内容的原因。任何帮助都会很棒。我确定它可能是一个我没见过的简单代码。
答案 0 :(得分:0)
你的问题实际上符合“太宽泛”的标志,因为看起来你自己没有尝试过并且遇到问题,但是要求我们为你提供代码。它不仅仅是一行简单的代码。
但是,我会在Parse上为你提供从ios指南剪下的代码,略微修改以获得你想要的阵列:
PFQuery *query = [PFQuery queryWithClassName:@"GameScore"];
[query whereKey:@"playerName" equalTo:@"Dan Stemkoski"];
[query includeKey:@"receivers"]; // Force parse to include the user objects of receivers
[query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
if (!error) {
// The find succeeded.
NSLog(@"Successfully retrieved %d scores.", objects.count);
// Do something with the found objects
for (PFObject *object in objects) {
// Write to log the email of every receiver
for (PFUser *receiver in object[@"receivers"]) {
[receiver fetchIfNeeded]; // fetches the object if it is still just a pointer (just a safety; it should be already included by the includeKey call earlier in the code
NSLog(@"Receiver: %@", receiver[@"email"]);
}
}
} else {
// Log details of the failure
NSLog(@"Error: %@ %@", error, [error userInfo]);
}
}];
祝你好运: - )