
- iOS Tutorial
- iOS - Home
- iOS - Getting Started
- iOS - Environment Setup
- iOS - Objective-C Basics
- iOS - First iPhone Application
- iOS - Actions and Outlets
- iOS - Delegates
- iOS - UI Elements
- iOS - Accelerometer
- iOS - Universal Applications
- iOS - Camera Management
- iOS - Location Handling
- iOS - SQLite Database
- iOS - Sending Email
- iOS - Audio & Video
- iOS - File Handling
- iOS - Accessing Maps
- iOS - In-App Purchase
- iOS - iAd Integration
- iOS - GameKit
- iOS - Storyboards
- iOS - Auto Layouts
- iOS - Twitter & Facebook
- iOS - Memory Management
- iOS - Application Debugging
- iOS Useful Resources
- iOS - Quick Guide
- iOS - Useful Resources
- iOS - Discussion
How to integrate a facebook login in swift for iOS App?
Social logins in applications have become a very common thing these days. Facebook login is one of them, in this article we’ll see how we can make use of facebook login, to access basic user information and login to the application.
Implementing facebook login in an application is a series of multiple steps, out of which even a single step can not be skipped.
The first step is to register as a developer on: https://developers.facebook.com/
Once you sign up as a developer and complete the required steps to sign up, you will be taken to dashboard. Which at present looks like as shown below.
Now from the top left menu, click on the arrow and select create new app, or create test app. Then you’ll get the following screen where you should enter the name of your app.
Once you are done with your project, go to Settings tab on the left side menu, and scroll down to Add Platform option, once you do that you’ll see an option to choose platform.
Select iOS from this menu. It will take you to another page, where you’ll have to enter your project details like: Bundle ID, Iphone Store ID etc.
Make sure that you enable Single Sign on from the menu as well.
This is all that’s required on the developer’s portal.
Now, go to your podfile, and add the following.
pod 'FBSDKCoreKit' pod 'FBSDKLoginKit'
Install the pod.
<key>CFBundleURLTypes</key> <array> <dict> <key>CFBundleURLSchemes</key> <array> <string>fb{your-app-id}</string> </array> </dict> </array> <key>FacebookAppID</key> <string>{your-app-id}</string> <key>FacebookDisplayName</key> <string>{your-app-name}</string> <key>LSApplicationQueriesSchemes</key> <array> <string>fbapi</string> <string>fb-messenger-share-api</string> <string>fbauth2</string> <string>fbshareextension</string> </array>
Now you need to configure your info.plist file
Replace app id and app name with actual values.
Now import login SDK to your view controller and use like this.
import FacebookLogin func viewDidLoad() { let loginButton = LoginButton(readPermissions: [ .publicProfile ]) loginButton.center = view.center view.addSubview(loginButton) }
- Related Articles
- How to integrate facebook in Android App?
- How to integrate PayU Money in iOS using swift?
- How to create a WebView in an iOS App using Swift?
- How to hide the status bar in a iOS App using Swift?
- How to create a Custom Dialog box on iOS App using Swift?
- How to integrate Facebook using Kotlin?
- Facebook Login using Python
- How to make an HTTP request on iOS App using Swift?
- How to make an HTTP POST request on iOS App using Swift?
- How to load and display an image on iOS App using Swift?
- How to Apply Gradient to the background view of the iOS Swift App?
- How to make the user login for an offline web app?
- How to create android app in facebook?
- How to display an image with rounded corners on iOS App using Swift?
- How to check notifications status for the iOS App
