【发布时间】:2016-09-01 18:05:45
【问题描述】:
我在 AppDelegate.swift 上使用以下代码来检查用户是否已登录以更改默认视图控制器。
if let user = PFUser.currentUser()!["username"] {
print("asldkeu \(user)")
// Code to execute if user is logged in
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let viewController = storyboard.instantiateViewControllerWithIdentifier("MainViewController")
self.window?.rootViewController = viewController
self.window?.makeKeyAndVisible()
} else {
// Default screen you set in info plist.
}
哪个工作正常,但问题是我无法更新我的在线解析用户数据。每当我尝试更新 Heroku Parse 应用程序上的任何数据时,都会收到以下错误代码:
Error Domain=Parse Code=206 "cannot modify user Jpibm8rWyI" UserInfo={code=206, temporary=0, error=cannot modify user Jpibm8rWyI, NSLocalizedDescription=cannot modify user
我正在使用下面的代码来更新解析数据:
if let games = PFUser.currentUser()?["gamesWon"]! {
print("asldkeu server: \(games as! Int)")
gamesWon = (games as! Int) + 1
print("asldkeu update: \(gamesWon)")
}
PFUser.currentUser()?["gamesWon"] = gamesWon
do {
try PFUser.currentUser()!.save()
} catch {
print("asldkeu \(error)")
}}
如果我使用 PFUser.currentUser()!.saveInBackground() 我不会收到错误消息,但不会保存数据。
任何帮助如何解决这个问题?
【问题讨论】:
-
有人吗?有什么?
-
您确定,您登录正确吗?您只能更改自己的用户
-
用户已正确登录。
-
你找到答案了吗?我有同样的问题,我发布到 parse-server github。我没有收到任何服务器错误。
-
只有当我更改公共读写的 ACL 时,我才设法更新数据。这是我发现的唯一让我的解析数据得到更新的方法。还创建了一个新的解析类来存储我的数据,我不会把它们放在用户身上。
标签: ios swift heroku parse-platform