ios - 解析 PFUser 数据未在 iPhone 模拟器上更新

标签 ios swift xcode parse-platform parse-server

由于某种原因,在模拟器上测试我的应用程序时,用户数据从未更新。例如,对象“age”的值可以更改为 22,但模拟器的行为就好像它仍然是 21。有人知道这是否只是模拟器问题,并且在手机上运行会有所不同吗?我的 iPhone 屏幕完全坏了,所以我现在无法测试。

最佳答案

在解析中,PFUserPFObject 的子类,更新 PFObjectParse iOS SDK你有很多方法可以做到这一点

有两种流行的方法:

例如 fetch :

guard let myUser = PFUser.current() else { return } // Get the current user
do {
try myUser.fetch()
} catch {
  print("Error when fetching the new data")
}

例如 fetchInBackground :

guard let myUser = PFUser.current() else { return } // Get the current user
myUser.fetchInBackground()

您还可以使用 fetchInBackgroundWithBlock 来关闭

关于ios - 解析 PFUser 数据未在 iPhone 模拟器上更新,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43749480/

相关文章:

ios - NSSet 上的核心数据一对多关系、分配、获取、谓词

ios - UIView 是 tableView 中的隐藏部分标题

arrays - 在数组中的 UIView 上调用自定义函数

XCode 3.2 : Changing the default "Code Sense" indentation and whitespaces

android - 使用 RectangleF 时 Xamarin.forms 错误

ios - 在多个页面控件上显示数组的单个元素

swift - 将 UnsafeMutablePointer 的实部提取为 Float 并将其存储在数组中

ios - 当连接到新的 UIViewController 并返回时,UICollectionViewCell 动画停止

ios - 在 xcode 上使用 sprite kit 创建黑洞

c++ - XCode 如何使用 LLDB?