Abd Alrahman Alhayek
Abd Alrahman Alhayek

Reputation: 1952

Initialize Facebook Core SDK for iOS using Objective C?

I want to add the Facebook Events tracking to my app, but as it appears Facebook SDK documentation only provides the code in Swift language:

class AppDelegate: UIResponder, UIApplicationDelegate {    
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {          
    ApplicationDelegate.shared.application(
        application,
        didFinishLaunchingWithOptions: launchOptions
    )

    return true
}

As I read I should use FBSDKApplicationDelegate but I'm not sure how.

Thanks

Upvotes: 4

Views: 1901

Answers (2)

Wouter Seyen
Wouter Seyen

Reputation: 76

Add

#import <AuthenticationServices/AuthenticationServices.h>
#import <SafariServices/SafariServices.h>
#import <FBSDKCoreKit/FBSDKCoreKit-Swift.h>

to your import statements and

[[FBSDKApplicationDelegate sharedInstance] application:application
                       didFinishLaunchingWithOptions:launchOptions];

to didFinishLaunchingWithOptions

Thanks to the react-native-fbsdk-next package for providing this information (https://www.npmjs.com/package/react-native-fbsdk-next#32-ios)

Upvotes: 1

Abd Alrahman Alhayek
Abd Alrahman Alhayek

Reputation: 1952

Initialize FBSDK

[FBSDKApplicationDelegate.sharedInstance application:application didFinishLaunchingWithOptions:launchOptions];

Upvotes: 2

Related Questions