简体   繁体   English

解析iOS-更新PFUser.currentUser()并保持会话

[英]Parse iOS - Update PFUser.currentUser() and keep session

I'm trying to update my current logged in user with the following code (iOS): 我正在尝试使用以下代码(iOS)更新当前登录的用户:

var currentUser:PFUser = PFUser.currentUser()!
currentUser.setObject(true, forKey: "phoneVerified")
currentUser.saveInBackground()

The user is authenticated via username and password. 通过用户名和密码对用户进行身份验证。

The column "phoneVerified" will be successfully updated with this code, but unfortunately the current user session will be deleted in parse. 使用此代码将成功更新“ phoneVerified”列,但不幸的是,当前用户会话将在解析中被删除。 After that I get an "invalid session token error" and the user has to login again. 之后,我收到“无效的会话令牌错误”,用户必须再次登录。 How can I update the current user data without deleting the session? 如何在不删除会话的情况下更新当前用户数据?

Many thanks!! 非常感谢!!

Found the problem: After removing "Parse.enableLocalDatastore()" I can change the user without losing the session. 发现问题:删除“ Parse.enableLocalDatastore()”后,我可以更改用户而不会丢失会话。 PFUser.enableRevocableSessionInBackground() is still set. PFUser.enableRevocableSessionInBackground()仍被设置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM