解析未创建的iOS signUpInBackgroundWithBlock会话

时间:2015-05-20 13:20:42

标签: ios swift session parse-platform

想知道是否有人知道使用signUpInBackgroundWithBlock()注册时不会设置会话的可能原因?创建用户时没有问题,但是从未设置会话(并且不会在数据浏览器中创建)。

我在App委托中有enableRevocableSessionInBackground(),这不是迁移。经过测试重置模拟器,仍然没有运气。登录会按预期设置会话。

有什么想法吗?

func processSignUp() {
    var userUsername = self.usernameField.text
    var userEmail = self.emailField.text.lowercaseString
    var userPassword = self.passwordField.text

    // Start activity indicator
    HUDController.sharedController.contentView = HUDContentView.ProgressView()
    HUDController.sharedController.show()

    // Create the user
    var user = PFUser()
    user.username = userUsername
    user.password = userPassword
    user.email = userEmail

    // Sign up in background
    user.signUpInBackgroundWithBlock {
        (succeeded, error) -> Void in
        if error == nil {                
            HUDController.sharedController.hide()
            let storyboard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
            let tourViewController : TourViewController = storyboard.instantiateViewControllerWithIdentifier("Tour") as! TourViewController
            self.navigationController?.pushViewController(tourViewController, animated: false)
        } else {
            HUDController.sharedController.hide()
            ErrorHandlingController.handleParseError(error!, viewController: self)
        }
    }
}

0 个答案:

没有答案