Integrating Facebook iOS SDK with Your Application

How to Integrate Facebook Login in iOS App

When people log into your app with Facebook, they can grant permissions to your app so you can retrieve information or perform actions on Facebook on their behalf. When you use the Facebook SDK, some events in your app are automatically logged and collected for Facebook Analytics unless you disable automatic event logging.

Project Creation

Note that some permissions will require a Login Review. Login A secure and convenient way for people to log into your app or website using Facebook. Enable Single Sign On. However, I would strongly advise you to read the official Facebook documentation regarding the login workflow and the Single Sign-On technology. Place the button in the center of your view.

For details about what information is collected and how to disable automatic event logging, see Automatic App Event Logging. Facebook Login for iOS - Quickstart When people log into your app with Facebook, they can grant permissions to your app so you can retrieve information or perform actions on Facebook on their behalf. Login Please log in to Facebook to create apps or register as a developer. Log in to Facebook. Navigate to your project folder in a terminal window.

  • In the iOS SDK.
  • Component SDKs.
  • Step 2: Link to the SDK.
  • La ronde du bien-être (French Edition).
  • Facebook-iOS-SDK on www.farmersmarketmusic.com;

Make sure you have the CocoaPods gem installed on your machine before installing the Facebook Login pod. If you don't have a Frameworks group in your project, create one by right-clicking on your project in Xcode's Project Navigator and selecting New Group.

So, go back to Xcode, click on the project target on the Project Navigator pane, and under the General tab copy the value of the Bundle Identifier field. Also, make sure to enable the Single Sign On toggle button. Finally, click on the Save Changes button and this step is ready. Next, visit this link , download the Facebook SDK for iOS and install the package following the instructions shown on-screen. By default, the package is extracted on the Documents directory of your user account on your computer.

You can either leave it there, or move it to another directory. By doing so, when you download and extract a new version of the SDK your project will be automatically updated when you re-open it. Leave the rest of options as they are, and click on the Finish button. Similarly, add the FacebookDisplayName key, and in its value paste the Display Name which you can also copy from the dashboard. Finally, create a new key named URL Types , and set its type to array with one item only. Give it the URL Schemes title and make it an array too.

App Overview

In the one and only item that should be contained, set the app ID value you copied from the Facebook dashboard, prefixing it with the fb literal. The next figure illustrates all the three additions on the. All steps described here are mandatory for every app that is supposed to integrate Facebook features. Thankfully, Facebook supports the creation and usage of fake, test users per app.

To create a test user at least for the sample app that we will implement here, go to the Facebook dashboard of the LoginSample app, and select the Roles option at the left menu. In the main dashboard area, click at the Test Users link at the top of it, and then click on the Add button, as you see in this figure:. A small window is appeared, where you set the number of test users you want to add, as well as some other options. If you want to create just one user, leave everything as they are and simply click on the Create Test Users button.

You could skip the creation of a new test user in case Facebook adds one by default, named Open Graph Test User. Anyway, here is the list of test users as they are shown on my dashboard, where everything has been automatically created:.

  • Auf der Suche nach der verlorenen Zeit - zur narrativen Konstruktion von Zeit in der erzählenden Literatur des 20. Jahrhunderts: Am Beispiel von Michael ... nach der verlorenen Zeit (German Edition);
  • Mankinds Final Revolution.
  • Graph API Explorer - Integrating Facebook iOS SDK with Your Application [Book]!
  • The Heretic.
  • Stay ahead with the world's most comprehensive technology and business learning platform..
  • Step 1: Configure Facebook App Settings for iOS.
  • !

At the right of the test users there are some options, which you can use to rename them, login to their fake account or add friends. Feel free to use them and see what they are for.

2. Set up Your Development Environment

The Facebook SDK for iOS is the easiest way to integrate your iOS app with Facebook. You have two ways to set up your app to use the Facebook SDK. To make your app compatible with iOS 11, be sure to use the latest the latest version of the Facebook iOS SDK, integrate it into your app, and recompile.

Later on we are going to use the e-mail address of a test user to login with Facebook. All the required preparation has been done, so we are now ready to proceed to implementation. As I have already said in the introduction, we are going to add a pre-made view, existing already built in the Facebook SDK. This view is based on a class named FBLoginView , and it has two advantages:.

Swift 3: Firebase Social Login - Facebook Authentication and Cocoapods

The first one includes all the necessary tasks needed to be done in order to display the view, and the second involves the implementation of some delegate methods for handling all changes been made on the login and session state. Specifically, the most important subview that we will add is the login view, which actually is the login button. Further than that, we will use three UILabel objects to display:. When the user is logged out, the all labels and the profile picture view will be hidden, with just one exception; the login status label. Add the following subviews to the View Controller scene:.

In order for the two UIView objects to properly work, we must modify their classes and set the Facebook-related ones. Setting these custom classes to the above views is not enough to make them work as expected.

Facebook SDK for iOS

One more touch is required, and that is to make a call to both of these classes in the application: Now, go to the AppDelegate. There is a workaround for that:. Finally, go to the Main. Specifically, be sure to match:.

Facebook Login for iOS - Quickstart

By simply doing all the previous preparation, the login view is ready to work. When the login button will be tapped, the user credentials must be given in order to get authenticated. This can take place in two ways: Either through the Safari app, or through the Facebook app if it is installed on your device note that the Facebook app works only on a real device, not in the Simulator. Once the login info has been provided, our app must take the control again, but besides that, the Facebook SDK must handle and determine the login process.

Powerful data, trends, and aggregated, anonymized audience insights about the people interacting with your app. Drive installs with Mobile App Install Ads. Increase engagement with Mobile App Engagement Ads. Find your target audience with Custom Audiences for Mobile Apps. Allow people using your app to share , send a message , or like content.

They can also share Custom Stories with Open Graph. Get data in and out of Facebook's social graph, query data, post stories, upload photos and perform other tasks.