我在parse.com中找到了示例。我有2個對象:郵政和評論,在評論的對象有一個collumn:「父」指針發佈OBJ,我想加入他們的行列:parse.com(Unity)中的關係查詢
var query = ParseObject.GetQuery ("Comment");
// Include the post data with each comment
query = query.Include("parent");
query.FindAsync().ContinueWith(t => {
IEnumerable<ParseObject> comments = t.Result;
// Comments now contains the last ten comments, and the "post" field
// contains an object that has already been fetched. For example:
foreach (var comment in comments)
{
// This does not require a network access.
string o= comment.Get<string>("content");
Debug.Log(o);
try {
string post = comment.Get<ParseObject>("parent").Get<string>("title");
Debug.Log(post);
} catch (Exception ex) {
Debug.Log(ex);
}
}
});
它的工作! 然後,我有2個對象:用戶和Gamescore,在Gamescore對象都有一個collumn:「playerName」指針後OBJ我想加入他們太:
var query = ParseObject.GetQuery ("GameScore");
query.Include ("playerName");
query.FindAsync().ContinueWith (t =>{
IEnumerable<ParseObject> result = t.Result;
foreach (var item in result) {
Debug.Log("List score: ");
int score = item.Get<int>("score");
Debug.Log(score);
try {
var obj = item.Get<ParseUser>("playerName");
string name = obj.Get<string>("profile");
//string name = item.Get<ParseUser>("playerName").Get<string>("profile");
Debug.Log(name);
} catch (Exception ex) {
Debug.Log(ex);
}
}
});
,但它不能正常工作,請幫助我!
幫我。請。任何人? – Clay