i following tutorials on parse.com don't seem working properly. here issue.
i have class called questions , class named _user of type pfuser (it has picture icon next class name). user logins via fb , registered _user. can see myself in _user class.
i make question , have field in question class named qowner, owner of question. being set when saving new question via ios app :
questioncard[@"qowner"] = [pfuser currentuser]; i can see objectid of myself in _user value inside qowner column, @ row current question made.


problem cannot retrieve values inside app. if place in correct place below:
pfquery *query = [pfquery querywithclassname:@"questions"]; [query addascendingorder:@"createdat"]; [query findobjectsinbackgroundwithblock:^(nsarray *objects, nserror *error) { if (!error) { // find succeeded. nslog(@"@@@ : retrieved %lu questions ", (unsigned long)objects.count); // found objects nslog(@"%@",objects); // fetched data pfobjects // need convert yesorno object // , add _cards array (pfobject *object in objects) { nslog(@"currentuser : %@",[pfuser currentuser]); pfuser *qowneruser = [object objectforkey:@"qowner"]; nslog(@"question made : %@",qowneruser); } ..... the following being printed:
1)
@@@ : retrieved 1 cards 2)
( "<questions: 0x17011f5c0, objectid: zzwgsfcieu, localid: (null)> {\n cardid = 999;\n qowner = \"<pfuser: 0x17037e000, objectid: ltdxp5k0n6>\";\n type = 0;\n }" ) 3)
currentuser : <pfuser: 0x174375e40, objectid: ltdxp5k0n6, localid: (null)> { facebookid = 10153480462518901; thumbnail = "<pffile: 0x174479a80>"; username = uyrrmfbxdhqr1ws4vwjcay2wx; } 4)
question made : <pfuser: 0x17037e000, objectid: ltdxp5k0n6, localid: (null)> { } 1-2-3 seem correct, can see pointer relation. why in 4 inside {} see nothing? have expected see same user details in 3.
am missing something?
parse not fetch pointer values default in query. have tell query include pointer data using includekey:. this:
pfquery *query = [pfquery querywithclassname:@"questions"]; [query addascendingorder:@"createdat"]; [query includekey:@"qowner"]; [query findobjectsinbackgroundwithblock:^(nsarray *objects, nserror *error) { ... }];
Comments
Post a Comment