ios - How to fetch a PFObject with all it's fields and related objects in one go? -


i have nsarray of pfobjects , want fetch data related objects in array in 1 go, afterwards there no need make new call parse. how can this?

my answer assuming array want contained in pfobject. can query object , use include key include array contained within key.

    pfquery *query = [pfquery querywithclassname:@"<object's class name>"];     [query wherekey:@"objectid" equalto:object.objectid];     [query includekey:@"<array key>"]; 

if objects in array have pointers other objects within them can use dot syntax fetch @ once.

   [query includekey@"<array key>.<pointer in object array key>"]; 

run query once set , should retrieve array of 1 object since objectids unique, within object array.

   [query findobjectsinbackgroundwithblock:^(nsarray *objects, nserror *error){         if(error){             // handle error         }else{             if([objects count] > 0){                  pfobject *object = objects[0]; // 1 matching object query                 nsarray *array = object[@"<array key>"]; // array want             }         }     }]; 

Comments

Popular posts from this blog

jQuery Mobile app not scrolling in Firefox -

c++ - How to add Crypto++ library to Qt project -

php array slice every 2th rule -