Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 解析链接/取消链接从未调用的用户完成块(Twitter/Facebook)_Ios_Swift_Parse Platform - Fatal编程技术网

Ios 解析链接/取消链接从未调用的用户完成块(Twitter/Facebook)

Ios 解析链接/取消链接从未调用的用户完成块(Twitter/Facebook),ios,swift,parse-platform,Ios,Swift,Parse Platform,我正试图通过Parse iOS SDK为Twitter和Facebook添加链接/取消链接功能,但我遇到了一个以前从未遇到过的问题-链接和取消链接用户的完成块从未被调用。下面是我用于链接/取消链接功能的代码,我想知道是否有人以前遇到过类似的问题,可能对问题所在有什么想法。谢谢 @IBAction func atnFacebookConnect(sender: AnyObject) { disableUserInteraction() self.actFacebookConnect

我正试图通过Parse iOS SDK为Twitter和Facebook添加链接/取消链接功能,但我遇到了一个以前从未遇到过的问题-链接和取消链接用户的完成块从未被调用。下面是我用于链接/取消链接功能的代码,我想知道是否有人以前遇到过类似的问题,可能对问题所在有什么想法。谢谢

@IBAction func atnFacebookConnect(sender: AnyObject) {
    disableUserInteraction()
    self.actFacebookConnect.startAnimating()
    let permissions = ["email","public_profile","user_about_me"]
    if btnFacebookConnect.titleLabel?.text == "Disconnect" {
        if let user = User.currentUser() {
            PFFacebookUtils.unlinkUserInBackground(user, block: { (success, error) -> Void in
                if error == nil && success == true {
                    self.checkIfUserIsLinkedToSocialMedia()
                }
                else {
                    iLikeyAlert(self, "", "Something went wrong", nil)
                }
                self.actFacebookConnect.stopAnimating()
                self.enableUserInteraction()
            })
        }
    }
    else if btnFacebookConnect.titleLabel?.text == "Connect" {
        if let user = User.currentUser() {
            PFFacebookUtils.linkUserInBackground(user, withReadPermissions:permissions, block: { (success, error) -> Void in
                if error == nil && success == true {
                    self.checkIfUserIsLinkedToSocialMedia()
                }
                else {
                    iLikeyAlert(self, "", "Something went wrong", nil)
                }
                self.actFacebookConnect.stopAnimating()
                self.enableUserInteraction()
            })
        }
    }
}

@IBAction func atnTwitterConnect(sender: AnyObject) {
    disableUserInteraction()
    self.actTwitterConnect.startAnimating()
    if btnTwitterConnect.titleLabel?.text == "Disconnect" {
        if let user = User.currentUser() {
            PFTwitterUtils.unlinkUserInBackground(user, block: { (success, error) -> Void in
                if error == nil && success == true {
                    self.checkIfUserIsLinkedToSocialMedia()
                }
                else {
                    iLikeyAlert(self, "", "Something went wrong", nil)
                }
                self.actTwitterConnect.stopAnimating()
                self.enableUserInteraction()
            })
        }
    }
    else if btnTwitterConnect.titleLabel?.text == "Connect" {
        if let user = User.currentUser() {
            PFTwitterUtils.linkUser(user, block: { (success, error) -> Void in
                if error == nil && success == true {
                    self.checkIfUserIsLinkedToSocialMedia()
                }
                else {
                    iLikeyAlert(self, "", "Something went wrong", nil)
                }
                self.actTwitterConnect.stopAnimating()
                self.enableUserInteraction()
            })
        }
    }
}