-
Notifications
You must be signed in to change notification settings - Fork 0
Facebook Ios Integration
To integrate Facebook SDK into your app.
Just need to follow the below implementation.
- First add the Facebook SDK in the iOS project Podfile. Below are the Facebook SDK which need to add on Podfile.
pod 'FBSDKCoreKit'
Also check the below screenshot for the reference

- After that need to run the below command on the terminal for updating the Pod file.
pod install
This is something look like the below screenshot

- Second, you need to add some line of code in the
info.plist
which is mentioned below
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>fb[Replace with App id]</string>
</array>
</dict>
</array>
<key>FacebookAppID</key>
<string>[Replace with App id]</string>
<key>FacebookClientToken</key>
<string>CLIENT-TOKEN</string>
<key>FacebookDisplayName</key>
<string>[Replace with app name]</string>
<key>FacebookAutoLogAppEventsEnabled</key>
<true/>
<key>FacebookAdvertiserIDCollectionEnabled</key>
<true/>
In the above code, you need to replace with your app info values.
-
fb[Replace with App id] // Place your iOS AppId here -
fb28684XXXXX36682
-
[Replace with App id] // Place your AppId here - 28684XXXXX36682
-
FACEBOOK-CLIENT-TOKEN // Place your Client token here - 961XXX32c8685XXXXXXXXXXXfdeb9fa2
-
[Replace with app name] // Place your app name here - AppName
Also, you can check the screenshot below for the reference

- After following the above steps, you need to add some line of code in
AppDelegate.swift
class
Import the FB sdk in the class - import FBSDKCoreKit and add the below code
ApplicationDelegate.shared.application( application, didFinishLaunchingWithOptions: launchOptions )
Please check below the example of the above code.
import UIKit
import Flutter
import FBSDKCoreKit
@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
ApplicationDelegate.shared.application(application,didFinishLaunchingWithOptions: launchOptions)
GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
}
Also, Check the screenshot of the class below
