【发布时间】:2015-08-27 19:07:01
【问题描述】:
我正在尝试使用 Parse 独占我的所有用户会话,这意味着如果用户已经在某个位置的某个设备上登录,如果另一个设备使用相同的凭据登录,我想要上一个会话(s ) 被终止,当然还有一条警报视图的消息。有点像旧的 AOL 即时消息格式。我认为这个动作的代码应该写在登录逻辑中,所以我在我的登录“成功”代码中写了这个:
PFUser.logInWithUsernameInBackground(userName, password: passWord) {
(user, error: NSError?) -> Void in
if user != nil || error == nil {
dispatch_async(dispatch_get_main_queue()) {
self.performSegueWithIdentifier("loginSuccess", sender: self)
PFCloud.callFunctionInBackground("currentUser", withParameters: ["PFUser":"currentUser"])
//..... Get other currentUser session tokens and destroy them
}
} else {
这可能不是正确的云代码调用,但您明白了。当用户在另一台设备上再次登录时,我想抓取其他会话并终止它们。有谁知道快速提出此请求的正确方法?
【问题讨论】:
标签: ios swift parse-platform xcode6 usersession