Wednesday, 15 April 2015

ios - PFQuery to load objects stored in an array in a PFObject into a PFQueryTableViewController -



ios - PFQuery to load objects stored in an array in a PFObject into a PFQueryTableViewController -

i have pfquerytableviewcontroller loads threads (pfobjects info forum thread) fine.

when cell pressed, new pfquertytableviewcontroller loads responses (pfobjects info user's response on thread), having problem making sure responses specific thread.

i can entire array of responses easily,

nsarray *responses = thread[@"responses"];

however, have no thought how utilize pfquery in pfquerytableviewcontroller. here's tried:

i got thought this forum post, doesn't me (self.objects empty).

- (pfquery *)queryfortable { pfquery *query = [pfquery querywithclassname:self.parseclassname]; nsarray *threads = self.topic[@"threads"]; (pfobject *thread in threads) { [thread fetchifneeded]; nslog(@"thread title: %@", thread[@"title"]); } [query wherekey:@"title" containedin:threads]; homecoming query; }

output:

thread title: title post "animal rights" 2014-06-20 10:25:11.730 thumbwar[9185:60b] fetched: <thread:daslkcuo77:(null)> { title = "this title post \"animal rights\""; user = "<pfuser:********>"; }

use includekey when threads in first pfquerytableviewcontroller. threads come responses , can pass these responses normal uitableviewcontroller when cell clicked.

- (pfquery *)queryfortable { pfquery *query = [pfquery querywithclassname:self.parseclassname]; [query includekey:@"responses"]; //retrieve responses of threads [query orderbydescending:@"createdat"]; //you may sort threads if want homecoming query; }

ios parse.com pfquery

No comments:

Post a Comment