【发布时间】:2017-04-20 19:18:17
【问题描述】:
我现在的问题是,如果数据库中的用户发生了一些变化(测试期间手动更改),客户端缓存的用户不会被更新。我知道我需要使用 fetch() 或其中一种变体(背景,如果需要),但我真的不知道如何。
这是我当前在 AppDelegate 中的代码,用于确定是显示登录屏幕还是进入主应用程序。
// Decide which controller to go to
self.window = UIWindow.init(frame: UIScreen.main.bounds)
var sb: UIStoryboard? = nil
if (PFUser.current() != nil) && (PFUser.current()?.isAuthenticated)! {
sb = UIStoryboard(name: "Main", bundle: nil)
} else {
sb = UIStoryboard(name: "SetupUser", bundle: nil)
}
let vc = sb?.instantiateInitialViewController()
self.window?.rootViewController = vc
self.window?.makeKeyAndVisible()
这在大多数情况下都有效,但如果用户从数据库中更新或删除,则应用将继续运行并在稍后由于更新/保存对象时出错而崩溃。
【问题讨论】:
标签: ios swift authentication parse-platform