Filtering undefined files in PFQuery

215 views Asked by At

I'm using Parse as a backend for storing image-based news items. Each news item has an image file. Some image files are 'undefined' and some have jpegs. I have an iOS app front end which shows news items in a PFQueryTableViewController. In the QueryForTable, I'd like to filter out records with undefined files.

I've tried this with no joy:

    - (PFQuery *)queryForTable {
        PFQuery *query = [PFQuery queryWithClassName:self.parseClassName];
        [query orderByDescending:@"EntryTime"];
        [query whereKey:@"Image" notEqualTo:@"undefined"];
        return query;
    }

And also:

    [query whereKey:@"Image" notEqualTo:@"null"];

Anyone know what the right way to treat 'undefined' files is?

Thanks!

1

There are 1 answers

0
gobob On BEST ANSWER

This worked.

    [query whereKeyExists:@"Image"];

in

    - (PFQuery *)queryForTable {
            PFQuery *query = [PFQuery queryWithClassName:self.parseClassName];
            [query orderByDescending:@"EntryTime"];
            [query whereKeyExists:@"Image"];
            return query;
        }