错误域=解析代码= 209“操作无法完成
我安装了ParseStarterProject swift版本,并使用以下代码创建了一个新用户:
var user = PFUser()
...
user.signUpInBackgroundWithBlock...
然后我再次运行该项目,并得到以下错误:
2015-03-26 09:49:25.485 ParseStarterProject [14768:199520] [Error]:无效会话令牌(代码:209,版本:1.7.0)2015-03-26 09:49:25.489 ParseStarterProject [14768:199521] [错误]:最终错误地运行命令失败:Error Domain = Parse Code = 209“操作无法完成(解析错误209.)”UserInfo = 0x7fcda3cb6680 {error = invalid session token,code = 209}
我做错了什么?
我认为让当前用户也执行登录,但它不。 所以问题是我试图保存一个对象而不执行登录。
func login() {
var username = username from UI or key store
var password = password from UI or key store
if let currentUser = PFUser.currentUser() {
println("current user is (currentUser.username)")
username = currentUser.username
}
PFUser.logInWithUsernameInBackground(username, password:password) {
(user: PFUser!, error: NSError!) -> Void in
if user != nil {
println("successful login with (user.username)")
self.saveSomething()
} else {
println("failed login with (user.username)")
}
}
}
func saveSomething() {
var gameScore = PFObject(className:"GameScore")
gameScore["score"] = 1337
gameScore["playerName"] = "Sean Plott"
gameScore["cheatMode"] = false
gameScore.saveInBackgroundWithBlock {
(success: Bool, error: NSError!) -> Void in
if (success) {
println("The object has been saved")
} else {
println("There was a problem, check error.description")
}
}
}
链接地址: http://www.djcxy.com/p/18305.html
上一篇: Error Domain=Parse Code=209 "The operation couldn’t be completed