你的問題實際上符合「太寬」的標誌,因爲它似乎你自己沒有嘗試過,並且遇到問題,但是要求我們爲您提供代碼。它不僅僅是一行簡單的代碼。
不過,我將向您提供從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]);
}
}];
好運:-)
謝謝你答覆。但是,接收數據不在用戶類中。你知道如何從不同的課程中拉出來嗎? – andrewxt
這裏沒有用戶類。這是來自GameScore類。用你的類名替換它。 「用戶」對象從您提到的「接收者」數組中獲取。 – Moonwalkr