【发布时间】:2015-07-29 11:22:29
【问题描述】:
我有一个用户注册和登录系统,其中用户存储了他的电子邮件地址和密码。
稍后我想向该用户添加更多信息,因此我在 parse.com 上创建了一个名为“UserProfile”的新数据类,我在其中存储来自已注册用户的 userObjectId。
所以现在我想在数据类 UserProfile 中更新这个用户,但我现在只是来自 UserClass 中的用户的 objectId。 所以我想像“更新用户,其中 userObjectId = PFUser.currentUser().objectId”一样更新
我已经有了这个 sn-p 代码:
var query = PFQuery(className:"UserProfiles")
var userId = PFUser.currentUser()?.objectId?
query.whereKey("userObjectId", equalTo: userId)
//i don't think, that the following code is correct
query.getObjectInBackgroundWithId("xWMyZEGZ") {
(gameScore: PFObject?, error: NSError?) -> Void in
if error != nil {
println(error)
} else if let gameScore = gameScore {
gameScore["cheatMode"] = true
gameScore["score"] = 1338
gameScore.saveInBackground()
}
}
【问题讨论】:
标签: xcode swift parse-platform