Integrate Facebook Sign In Button in Your iOS App within 60 Minutes!

September 27, 2016 4289

Integration of Facebook sign in button is quite common in mobile apps. It allows app users to register themselves through a single tap on the screen of their smartphones. And the main benefit you get is that your app registration rate boosts.

By adding a Facebook login button, not only it allows to attach social characteristics, but it is used as a login system instead of creating long registration forms.

This Facebook login integration is supported since the launch of iOS 6, even when it is still necessary to add Facebook SDK manually in your app. However, in this iOS app tutorial, we’re going to approach with a relatively easy approach.

With this approach, you’ll learn how to add Facebook sign in button that provides app users a standard Facebook button to log in and log out from the iOS app.

Let’s Get Started!

Create a new project under the file menu and select ‘Single View Application’.

In the next tab, give a name to your project. Here, we’re going to name it as “SOSocialLogin”.

Fill the Display Name (app name), Contact Email, and Category and click on “Create App ID”.

Once you create App ID, it’ll navigate you to Facebook app dashboard.

Here, go to Get Started With The Facebook SDK and click on “Choose a Platform”.

Select iOS from the given options and follow the rest of the steps given by Facebook iOS SDK document.

After following all these steps, go to “App Review” section and Make SOSocialLogin public key to YES.

Once finished with this, it’s time to start coding in XCode.

import FBSDKCoreKit in AppDelegate.swift and add the following delegate for invoking proper processing of responses during interaction with native Facebook app or Safari for authorization flow.CocoaLigature1

If your Facebook session is active then for log out you need to use logout() function of FBSDKLoginManager

//Facebook Logout
loginManager.logOut()

That’s it! This is the easiest way you can integrate Facebook login button in your iOS app within just 60 minutes. However, if you face any issue implementing Facebook login button in your iOS app, you can contact us.

Space-O Technologies is an award-winning iPhone app development company in India with more than 5 years of experience. Additionally, we’ve already worked with 25+ successful startups throughout our journey and helped them to achieve success with such features. Therefore, you can be the rest assured that your mobile app development project is in good hands!