Skip to content
Aegisiscblog AegisISC Blog

General Information Blog

  • Business
  • Mobiles
    • Android
    • iPhone
  • Software
    • .Net
    • CRM
    • Java
    • AX
  • Web
    • Hadoop
    • Python
    • Magento
  • General
    • Guest
  • How To
  • Contact Us
  • Business
  • Mobiles
    • Android
    • iPhone
  • Software
    • .Net
    • CRM
    • Java
    • AX
  • Web
    • Hadoop
    • Python
    • Magento
  • General
    • Guest
  • How To
  • Contact Us
  • Home
  • Swift Facebook Log-in Integration for iPhone App Development
Posted iniPhone

Swift Facebook Log-in Integration for iPhone App Development

Posted by By Vijay Aegis August 13, 2016
Swift Facebook Log-in Integration for iPhone App Development

This post has all the steps that iPhone app development company professionals follow to integrate Facebook log-in using Swift. You can read this post and discover what steps are involved and how the team of experts do it.

One-liner: In this tutorial, we will learn how to integrate Facebook Log-in using Swift.

Features: You can log-in directly in the application and fetch user details.

Starts with creating one single view application with the product name “SwiftFacebookIntegration”. In the language, field select Swift and in device field select iPhone.

Before we start coding, we require to create and register Application on Facebook.

Now, to create an application on Facebook follows the below steps:

  1. Go to https://developers.facebook.com and login with your developer account or sign for one.
  2. Click on “My Apps” and select “Add a New App”.
  3. Enter your app name, Contact email and category of your app.
  4. Go to dashboard screen and select setting -> Add Platform ->
  5. Copy Bundle ID from Xcode project and paste in Bundle Id field.
  6. Click to enable to “Single Sign On”.
  7. Click “Save Changes”.

Download Facebook iOS SDK from here. After download adds FBSDKLoginKit.framework and FBSDKCoreKit.framework in your project.

In info.plist file we have to set returning URL or redirect URL and add Facebook ID. Make required changes as shown in below screenshot.

Open AppDelegate.swift and import FBSDKCoreKit and FBSDKLoginKit frameworks. For configuring Facebook Login with application implement code in didFinishLaunchingWithOptions() like below screenshot. Next, add method openURL() for managing flow once user login and return to the application. For more info, please check below screenshot.

Open Main.storyboard and add one UIImageView in the main view for display user profile picture. Ctrl-drag from image to class and set outlet “facebookImage”. Add one UIView like button size and set class FBSDKLoginButton in identity inspector. Ctrl-drag from the button to class and outlet “btnFacebook”. Add two UILabel with outlet “facebookName” and “facebookEmail” respectively. Please check below screenshots for more info.

Open ViewController.swift file and import FBSDKCoreKit and FBSDKLoginKit frameworks. Next set delegate “FBSDKLoginButtonDelegate”. In viewDidLoad() method add read permissions and delegate. Check below screenshot for more info.

Next two methods are delegate methods of FBSDKLoginButtonDelegate. In the first method if user login successfully we can fetch user info like name, email and profile picture. The second method is for logout. Please check below screenshot.

Now build and run project. If everything is correct, your app should run properly with below output.

iPhone app development company, experts have shared their experience of swift facebook login integration. If there is anything unclear to you, let them know via your comments.

Share via:

  • Facebook
  • X (Twitter)
  • LinkedIn
  • More
Tags:
Facebook Log-in Integration iOSiphone app development
Last updated on November 26, 2022
Vijay Aegis
View All Posts

Post navigation

Previous Post
EMR Consulting What is EMR in HealthCare – All about EMR Consulting India
Next Post
Sqoop – Hive Job Failed When Executing With Query Option Sqoop – Hive Job Failed When Executing With Query Option

Agatha Christ
Founder & Editor

Hello! My name is Agatha Christie. I work for AegisiscBlog as a blogger and link exchange webmaster.

Trending
  • Shearing machine manufacturer india
    Why Shearing Machine Manufacturers in India Are Leading the Global Market
  • DevOps
    10 Ways in Which DevOps Is Changing Development World
  • UI Kits for App Designers
    15 Free UI Kits for App Designers to Design Top-Notch Mobile App
  • 3 Crucial Tips For Dog Walkers
  • 3 Most Common Problems With Automatic Doors
Trending Posts
Shearing machine manufacturer india
Shearing machine manufacturer india
Why Shearing Machine Manufacturers in India Are Leading the Global…
Casting Foundry India
Casting Foundry India
Casting Foundry India: At the Very Geometry of Precision Manufacturing
FRP Moulded Gratings
FRP Moulded Gratings
FRP Profiles in Urban Mobility: Rethinking Infrastructure for Smart Cities
Editor’s Pick
The tremendous impact of .NET Web Development in the modern era
The tremendous impact of .NET Web Development in the modern…
How Can One Enhance The Patient Engagement With Latest Solutions?
How Can One Enhance The Patient Engagement With Latest Solutions?
An Overview On The HL7 Interface Development
An Overview On The HL7 Interface Development
Popular Posts
Magento development
Role of Magento Themes To Improve Website Productivity
The tremendous impact of .NET Web Development in the modern era
The tremendous impact of .NET Web Development in the modern…
How Can One Enhance The Patient Engagement With Latest Solutions?
How Can One Enhance The Patient Engagement With Latest Solutions?
Copyright 2025 — AegisISC Blog. All rights reserved.
Scroll to Top
  • Facebook
  • X (Twitter)
  • LinkedIn
  • More Networks
Share via
Facebook
X (Twitter)
LinkedIn
Mix
Email
Print
Copy Link
Copy link
CopyCopied
We use cookies in order to give you the best possible experience on our website. By continuing to use this site, you agree to our use of cookies.
Accept