ios - 解析 : How can I update all rows with the same key value

标签 ios swift parse-platform

如何在 Parse 类中更新具有相同键值的所有行? 作为我的代码,如果每个用户有 100 个对象,我认为 Parse 会花费我很多钱。 还有其他方法吗?

    let username = PFUser.currentUser()?.username
    let objectQuery = PFQuery(className: "FriendList")
    objectQuery.whereKey("username", equalTo: username!)

    objectQuery.findObjectsInBackgroundWithBlock { (friendList:[AnyObject]?, error:NSError?) -> Void in
        if let friendList = friendList as? [PFObject] {
            for myInfo in friendList {
                myInfo["contact"] = contact
                myInfo["portrait"] = PFFile(data: portraitNSData)
                myInfo["company"] = company
                myInfo["position"] = position
                myInfo.save()  // create a request?
            }
        }
    }

最佳答案

形成所需对象的数组,而不仅仅是

PFObject.saveAllInBackground(objectsArray)

关于ios - 解析 : How can I update all rows with the same key value,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30834904/

相关文章:

ios - TableView 中的动态节数和行数

objective-c - 如何在NSArray上使用自定义排序

iOS-如何在 UITableview 中使用数组快速在一个原型(prototype) Cell 中显示 40 张图像?

ios - 查询晚于 24 小时的对象

swift - Parse.com 安装 - 设备上打开的时间

iphone - 覆盖类实例的函数

ios - 在swift 3中从视频中提取帧

ios - NSNotification 用户信息在按下按钮时保持堆叠

ios - Interface Builder 无法确定 "Main.storyboard"的类型。这可能是由于缺少 SDK

ios - 如果设备被拔掉,解析无声推送通知不工作