我在名为 “website”
的 PFUser 列中有自定义值。我正在尝试使用下面的代码获取此值,但如果我使用数据查看器在他们的网站上更新来自 Parse.com 的值,它似乎不会在设备上更改。它也不会跨设备更新。
有什么想法吗?
websiteField.text = currentUser.objectForKey("website") as String
最佳答案
我已经设法让它与下面的代码一起工作。
var currentUser = PFUser.currentUser()
currentUser.refreshInBackgroundWithBlock { (object, error) -> Void in
println("Refreshed")
currentUser.fetchIfNeededInBackgroundWithBlock { (result, error) -> Void in
self.websiteStr = currentUser.objectForKey("website") as String
self.websiteField.text = self.websiteStr
println("Updated")
println(self.websiteStr)
}
}
关于swift - 获取 PFUser 对象自定义值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27284575/