I went through the same struggle and tried many different ways to configure Parse with Facebook Login. I must say, however, I have no experience with Obj-C, but here is my working Swift Parse w / Facebook Login application, which I hope will give you some insight.
In my AppDelegate.swift :
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject : AnyObject]?) -> Bool { Parse.setApplicationId("ID", clientKey:"KEY") PFFacebookUtils.initializeFacebookWithApplicationLaunchOptions(launchOptions) FBSDKProfile.enableUpdatesOnAccessTokenChange(true) return FBSDKApplicationDelegate.sharedInstance().application(application, didFinishLaunchingWithOptions: launchOptions) } func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject?) -> Bool { return FBSDKApplicationDelegate.sharedInstance().application(application, openURL: url, sourceApplication: sourceApplication, annotation: annotation) } func applicationDidBecomeActive(application: UIApplication) { FBSDKAppEvents.activateApp() }
In my LoginViewController.swift :
//My custom storyboard button @IBAction func fbLogin(sender: AnyObject) { var permissions = ["public_profile", "email"] PFFacebookUtils.logInInBackgroundWithReadPermissions(permissions) { (user: PFUser?, error: NSError?) -> Void in if let user = user { if user.isNew { println("User signed up and logged in through Facebook!") self.facebookSignUp(user) } else { println("User logged in through Facebook!") self.performSegueWithIdentifier("LoginSuccessful", sender: self) } } else { println("Uh oh. The user cancelled the Facebook login.") } } } override func viewDidLoad() { super.viewDidLoad() if PFUser.currentUser() != nil { moveToNextView() //Segue to next ViewController } } func facebookSignUp(user: PFUser) -> Void{ var request = FBSDKGraphRequest(graphPath: "me", parameters: nil) var userID:String request.startWithCompletionHandler { (connection: FBSDKGraphRequestConnection!, result: AnyObject!, error: NSError!) -> Void in if error == nil { user["fullName"] = result["name"] var facebookUserID = result["id"] as! String user["facebookUserID"] = facebookUserID user.save() self.performSegueWithIdentifier("LoginSuccessful", sender: self) } else { println(error) PFUser.logOut() } } }
source share