ios - 在 Parse 中,我如何编写一个查询来为我提供带有 id 列表的所有对象?操作系统

标签 ios parse-platform

我有一些代码需要很长时间才能加载,我想加快速度。

我的最终目标是通过 ID 数组获取对象列表。

现在我正在遍历我的 id 字符串数组,并构建用户对象以附加到 whereKey,但想知道是否有更好的方法来做到这一点。

            NSMutableArray *followingArray = [[NSMutableArray alloc] init];
            for (NSString *userId in c_user.following) {
                PFQuery *getUser = [FSUser query];
                FSUser *user = (FSUser *)[getUser getObjectWithId:userId];
                [followingArray addObject:user];
            }
            [query whereKey:@"owner" containedIn:followingArray];

最佳答案

编辑:您可以做的是使用用户 objectId 构建一个指针,然后查询它。

NSMutableArray* followingArray = [[NSMutableArray alloc] init];
for (NSString* userId in c_user.following) {
    // build the pointer to the object
    PFObject* object = [PFObject objectWithClassName:@"_User"];
    object.objectId = userId;
    [followingArray addObject:object];
}

[query whereKey:@"owner" containedIn:followingArray];

关于ios - 在 Parse 中,我如何编写一个查询来为我提供带有 id 列表的所有对象?操作系统,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32052924/

相关文章:

ios - 从App Delegate检查屏幕上的UIAlertViews

ios - 删除 UITableView 中单元格前的空白

javascript - 获取对象时如何干净地提取 Parse.Object 关系的记录?

安卓解析 : Can't update local user

ios - 当我尝试向 PFRelation 添加新对象时应用挂起

ios - 如何使用 swift 从 Parse.com 加载视频?

ios - 解析,如何通过 PFRelation 进行查找

php - 将打开我的应用程序或应用程序商店的共享链接

ios - KeychainItemWrapper 链接错误

iPhone/iPad IOS App Instrument 内存计数与 task_info 内存计数