Building an iOS app using Facebook login with Parse

Xcode 6.4 — iOS 8.4— Swift 1.2 — Parse iOS SDK 1.7.5 — Facebook iOS SDK 4.4.0 — Facebook API 2.4

If you want to create an app that uses Facebook only login, with a Parse backend, here is how to do it.

Integrate the Facebook SDK

  1. Create a new Facebook app at https://developers.facebook.com/
  2. In Settings, add a platform (iOS). Input an Bundle Id. You can leave iPhone Store Id and iPad Store ID to 0 until you obtain a real Id. iPad Store Id is the same as iPhone Store Id if it’s an universal app.
  3. On Parse, go to Settings->Authentication and add your Facebook Application’s App Id and App Secret.
  4. Download and install the Facebook iOS SDK from the Quick Start guide. You can follow that guide, or the Getting Started guide.
  5. Add FBSDKCoreKit.Framework, FBSDKLoginKit.Framework and FBSDKShareKit.Framework into your iOS project.
  6. Add these to your info.plist:
  7. FacebookAppID as a String type and input your Facebook App ID
  8. FacebookDisplayName as a String type and input your Facebook App Name
  9. URL types as an Array type containing one element Items 0 as a Dictionary type containing on element URL Schemes as an Array type containing one element Item 0 as a String type having the value fb<Facebook App ID>
  10. (iOS 9 only) LSApplicationQueriesSchemes as an Array type with one element of String type containing an element of String type having value fbauth.
<key>LSApplicationQueriesSchemes</key>
<array>
<string>fbauth</string>
</array>

Integrate the Parse SDK

  1. Download and install the Parse iOS SDK here: https://www.parse.com/docs/downloads
  2. Follow this guide to setup the Parse SDK with your iOS project: https://www.parse.com/apps/quickstart#parse_data/mobile/ios/native/new

Add these lines of code to AppDelegate.swift:

import FBSDKCoreKit
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
PFFacebookUtils.initializeFacebookWithApplicationLaunchOptions(launchOptions)
}

Like what you read? Give Van Du Tran a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.