0

我使用 Parse 作为存储基于图像的新闻项目的后端。每个新闻项目都有一个图像文件。有些图像文件是“未定义的”,有些是 jpegs。我有一个 iOS 应用程序前端,它在 PFQueryTableViewController 中显示新闻项目。在 QueryForTable 中,我想过滤掉未定义文件的记录。

我没有高兴地尝试过这个:

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

并且:

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

任何人都知道处理“未定义”文件的正确方法是什么?

谢谢!

4

1 回答 1

0

这行得通。

    [query whereKeyExists:@"Image"];

    - (PFQuery *)queryForTable {
            PFQuery *query = [PFQuery queryWithClassName:self.parseClassName];
            [query orderByDescending:@"EntryTime"];
            [query whereKeyExists:@"Image"];
            return query;
        }
于 2015-06-09T14:52:25.963 回答