小编Chr*_*gel的帖子

将匿名用户转换为parse.com中的登录用户时,sessiontoken无效

我在iOS上使用Swift.

我的应用有一个帖子列表.您可以匿名阅读,但必须注册才能发布.

当您打开应用程序时,您将获得一个匿名帐户.我在AppDelegate中添加了以下内容

PFUser.enableAutomaticUser()
PFUser.currentUser()?.incrementKey("RunCount")
PFUser.currentUser()?.saveInBackground()
Run Code Online (Sandbox Code Playgroud)

我从以下代码获得了代码:https://www.parse.com/docs/ios/guide#users-anonymous-users

当你去发布我告诉你

let user = PFUser.currentUser()
user?.username = displayNameTextField.text
user?.password = passwordTextField.text
user?.email = emailTextField.text
user!.signUpInBackgroundWithBlock { ... }
Run Code Online (Sandbox Code Playgroud)

这成功了.我可以在服务器上看到用户正在更新.但是我收到209错误:[错误]:会话令牌无效(代码:209,版本:1.7.4)

我已经尝试查看sessiontoken并在每一步打印出来并保持不变.我听说当用户注销时sessiontokens无效,但我以为我只是签了用户而不是用户.为什么sessiontoken无效?

我已尝试使用sessiontoken将用户设置为PFUser.Become()的当前用户,但这也不起作用.

我显然忽略了一些东西,但我无法弄清楚是什么.任何帮助都非常感激.

ios parse-platform swift

7
推荐指数
1
解决办法
890
查看次数

如何更改现有 UIAlertAction 的标题?

我在操作表中有一个喜欢按钮:

likeAction = UIAlertAction(title: "Like this post", style: UIAlertActionStyle.Default, handler: { (action) -> Void in
        println("like pressed")
})
Run Code Online (Sandbox Code Playgroud)

一旦按下,我想将标题更新为“与此帖子不同”

标题是只读的,并且 UIAlertActions 上没有 SetTitle() 函数。

非常感谢您的想法。

uikit ios swift

2
推荐指数
1
解决办法
1272
查看次数

标签 统计

ios ×2

swift ×2

parse-platform ×1

uikit ×1