Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook iOS SDK does not have FBSDKApplicationDelegate class and its methods

I'm using in Facebook login in app so I've installed FBSDKLoginKit in my app using cocoapods.

I've followed the Facebook documentation and finished all the steps except this FBSDKApplicationDelegate.sharedInstance().application(application, didFinishLaunchingWithOptions: launchOptions).

The method application(application, didFinishLaunchingWithOptions: launchOptions) is not available in FBSDKLoginKit.

like image 611
Mahendra Avatar asked May 03 '19 11:05

Mahendra


People also ask

What is the Facebook SDK for iOS?

The Facebook SDK for iOS contains component SDKs that you can connect to individually. Drive installs with Mobile App Install Ads. Increase engagement with Mobile App Engagement Ads.

How do I update the Facebook SDK for my App?

If you use SPM or CocoaPods to integrate the Facebook SDK, see the Upgrade Guide for information on how to update your app. You can also download the latest version of the Facebook iOS SDK, integrate it into your app, and recompile.

What is Facebook-iOS-SDK?

GitHub - facebook/facebook-ios-sdk: Used to integrate the Facebook Platform with your iOS & tvOS apps. This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Why should I subscribe to iOS SDK releases?

Please take a moment and subscribe to releases so that you can be notified about new features, deprecations, and critical fixes. To see information about the latest release, consult our changelog. We have begun rewriting the iOS SDK in Swift in order to modernize the code base.


2 Answers

I've gone through their documentation but they did not specified any thing but I've found the following things in ChangeLog (on git).

  • NS_SWIFT_NAME was applied where applicable. Most of these changes Xcode can fix automatically.

  • The FBSDK prefix for UI elements has been replaced with the simpler FB prefix.

  • The FBSDK prefix for all other types has been removed. FBSDKError is now CoreError.

So the class FBSDKApplicationDelegate now has been renamed to ApplicationDelegate for swift developer.

For objective-c developer this remains same.

Works For FBSDK version before 5.0.0

FBSDKApplicationDelegate.sharedInstance().application(application, didFinishLaunchingWithOptions: launchOptions)

Works For FBSDK version 5.0.0 and later

ApplicationDelegate.shared.application(application, didFinishLaunchingWithOptions: launchOptions)

Hope this will help other:) (Before Facebook update their documentation)

For complete change log for version 5.0.0 click here

like image 162
Mahendra Avatar answered Nov 15 '22 19:11

Mahendra


If you use Swift you need to use this for FBSDKLoginKit after 5.0 (source here):

ApplicationDelegate.shared.application(application, didFinishLaunchingWithOptions: launchOptions)
like image 42
fl0_9 Avatar answered Nov 15 '22 21:11

fl0_9