Search code examples
objective-cparse-platformpfqueryalloclocal-datastore

Can I construct a PFQuery that queries all classes?


i have an ios application in which i create a number of different classes of PFObjects, and i use pinning to the local datastore to take care of situations when i don't have network connectivity.

i'd like to query the local datastore from time to time in order to get all the objects in the store, irrespective of class.

i haven't been able to do this yet. the following code works fine and finds all the items of class MyClass

PFQuery *localStoreQuery = [[PFQuery alloc] initWithClassName:@"MyClass"];
[localStoreQuery fromLocalDatastore];
NSArray *results = [localStoreQuery findObjects];

but the following gives the error [Error]: bad characters in classname: (null) (Code: 103, Version: 1.8.5)

PFQuery *localStoreQuery = [[PFQuery alloc] init];
[localStoreQuery fromLocalDatastore];
NSArray *results = [localStoreQuery findObjects];

i also tried putting in @"*" as the classname like so

PFQuery *localStoreQuery = [[PFQuery alloc] initWithClassName:@"MyClass"];

but this also fails

so...is there any way to generically grab all pinned items of all classes, or do i have to have a loop and query each class i am creating separately (ugh)?

any help much appreciated.


Solution

  • Unfortunately you cannot. Parse does not support multi-class queries. You'd have to do each one, or make a super class that contains pointers to the object you'd like.