无法精确定位FBSDKGraphRequest崩溃

时间:2015-08-13 22:11:02

标签: facebook swift parse-platform

我使用FB登录,我的应用程序在该方法中时不时地崩溃。它适用于我,但不适用于其他一些用户。在此功能中,我使用从FBSDKGraphRequest收到的数据在Parse中设置用户数据。

// Sends FB Graph Request and sets user attributes in Parse
    func setUserData() {

        var user = PFUser.currentUser()!

        let graphRequest : FBSDKGraphRequest = FBSDKGraphRequest(graphPath: "me", parameters: nil)
        graphRequest.startWithCompletionHandler({ (connection, result, error) -> Void in

            if ((error) != nil)
            {
                println("Set user values error: \(error)")
            }
            else
            {

                firstName = result.valueForKey("first_name") as! NSString
                lastName = result.valueForKey("last_name") as! NSString
                user["name"] = "\(firstName) \(lastName)"

                NSUserDefaults.standardUserDefaults().setObject("\(firstName) \(lastName)", forKey: "name")

                id = result.valueForKey("id") as! NSString
                user["fbID"] = id

                gender = result.valueForKey("gender") as! NSString
                user["gender"] = gender

                email = result.valueForKey("email") as! NSString
                user["email"] = email

                user["score"] = 100

                user.saveInBackgroundWithBlock({ (success, error) -> Void in
                    if success {
                        objID = user.objectId!
                    }
                })
                self.performSegueWithIdentifier("segue", sender: self)
            }

        })

    }

现在,在Crashlytics中,我获得了EXC_BREAKPOINT,但无法确切地知道崩溃的来源或做些什么。看起来它可能来自Facebook的一方?任何帮助将不胜感激。

enter image description here

1 个答案:

答案 0 :(得分:-1)

我遇到了同样的问题。我忘了把权限放在FBSDKLoginButton:

    facebookLoginButton.readPermissions = ["public_profile", "email", "user_friends"];

也许你也忘了它?