Facebook Login Quick Start – iOS Swift 3 and Xcode 8

Here is yet another entry in my iOS developer journey in which I try to improve upon available official documentation.

Facebook’s login SDK for iOS has been around for a while and has gone through several iterations/updates. There are various tutorials online which have these issues among others:

  • Official Facebook Login SDK for Swift docs do not go over required Info.plist and AppDelegate.swift changes for their SDK to work, and appears to use old Swift 2 syntax.
  • Various online tutorials are still using no longer necessary objective-C bridging headers.
  • Facebook’s developer quick start for iOS steps only use objective-C syntax.

So as with Parse, I will combine the steps for doing a quick and easy Facebook Login setup in Swift 3.

Quick Start

  1. Create new app at https://developers.facebook.com. This is straight-forward and simply requires a unique display name.
  2. Install Facebook libraries using cocoapods. You can do this using carthage or manually, but so far I’ve found cocoapods to be the most ubiquitous and easy way. If you haven’t used Cocoapods before, my previous post on using Parse has some additional information.
  3. Go to your new facebook app’s dashboard on https://developers.facebook.com and use “Quick Start” button under Facebook Login section to set your bundle identifier and to get the required code for your project’s Info.plist file. You can ignore/skip all the steps except 3 and 5. Make sure you get both sections for your Info.plist file in step 5.
  4. Add AppDelegate.swift methods that enable Facebook to leave and return to your app when your users try to sign in with Facebook.
  5. Finally add the code for creating a facebook login button in your app.

You should now have an access token with public profile permissions for the user account that signed in with the facebook login button.


  • You may get the error: “OSStatus error -10814″. Don’t worry, this just means the facebook app isn’t installed in your simulator or on your device. Facebook Login API will still work.
  • [Update September 27, 2017] You might notice 3 errors (“contentDescription” etc) in your xcode project resulting from the facebook cocoapods. There’s an existing issue thread about these due to deprecated code, and it might very well be fixed by the time you’re reading this tutorial. The fix is easy, as you can simply comment out the lines that result in the errors.
This entry was posted in all. Bookmark the permalink.

9 Responses to Facebook Login Quick Start – iOS Swift 3 and Xcode 8

  1. mac senour says:

    Really needs updating. This doesn’t work at all.

    • Roman says:

      Hey Mac. I just ran through the steps and other than a minor issue due to deprecated code in the facebook cocoapods (see update at the end of the post), they worked perfectly. What didn’t work for you?

      • Mac Senour says:


        I get an “no module” error when I put “import Facebooklogin” in my ViewController. It’s a setup issue I’m sure, bu this tutorial doesn’t cover that and it’s vital.

        • Roman says:

          Steps 1-3 is all setup :). Make sure you’re importing ‘FacebookLogin’ with a capital L. And don’t forget to run ‘pod install’ after creating the podfile. My previous tutorial covers cocoapods in a bit more detail if you’ve never used them before: http://coderoman.com/2016/11/parse-quick-start-for-ios-swift-3-and-xcode-8/

          • mac senour says:

            Nope… I get this:

            import FacebookCore No such module ‘FacebookCore’

            This is my podfile output:

            Macintosh:FacebookLoginExample rsenour$ pod install
            Analyzing dependencies
            Downloading dependencies
            Installing Bolts (1.8.4)
            Installing FBSDKCoreKit (4.26.0)
            Installing FBSDKLoginKit (4.26.0)
            Installing FBSDKShareKit (4.26.0)
            Installing FacebookCore (0.2.0)
            Installing FacebookLogin (0.2.0)
            Installing FacebookShare (0.2.0)
            Generating Pods project
            Integrating client project

            [!] Please close any current Xcode sessions and use FacebookLoginExample.xcworkspace for this project from now on.
            Sending stats
            Pod installation complete! There are 3 dependencies from the Podfile and 7 total pods installed.

        • Roman says:

          You’re definitely opening the newly created .xcworkspace file correct? I’ve ran into the “no such module” issue once before and was able to fix it by performing clean folder function:
          Press Command+Option+Shift+K and then Run your app.
          Or from the menu -> Product, press Option on your keyboard and you’ll see Clean Build Folder.

          Once it only worked after restarting the computer. Xcode is just weird sometimes :\. Let me know if that fixes it, I’ll add it to this post as well.

  2. mac senour says:

    OK, it works now… resetting helped and there was some code that had to be modified. I realized only tonight that I’m using Xcode 9. Sheesh. Thanks for your patience.

Leave a Reply