Overview
ApplicationDelegate is the main entry point for the Facebook SDK. Its methods mirror those in UIApplicationDelegate, and you call them from the corresponding methods in your own app delegate. The class manages URL handling for Facebook Login, SSO flows, and universal links, and it notifies registered observers of application lifecycle events.
| Module | FacebookCore |
| Objective-C name | FBSDKApplicationDelegate |
| Availability | iOS 12+ |
Singleton
The singleton instance. Use this instead of creating your own instance.
Methods
initializeSDK()
Initializes the SDK outside of a UIApplication lifecycle context. Call this method when no UIApplication instance is available — for example, in an app extension or a unit test host.
application(_:didFinishLaunchingWithOptions:)
Call this from your UIApplicationDelegate.application(_:didFinishLaunchingWithOptions:) method. It initializes the SDK and triggers auto-logging of basic app events if FacebookAutoLogAppEventsEnabled is set in your Info.plist.
The application object passed to your app delegate method.
The launch options dictionary passed to your app delegate method.
true always.
application(_:open:options:)
Call this from your UIApplicationDelegate.application(_:open:options:) method to handle URL responses from Facebook Login, Facebook Dialogs, and other SSO flows.
The application object passed to your app delegate method.
The URL to handle, as passed to your app delegate method.
The options dictionary passed to your app delegate method.
true if the URL was intended for the Facebook SDK, false otherwise.
application(_:continue:userActivity:)
Call this from your UIApplicationDelegate.application(_:continue:restorationHandler:) method to handle universal links (web URLs) that redirect back to your app.
The application object passed to your app delegate method.
The user activity object passed to your app delegate method. The SDK only acts on activities whose
activityType is NSUserActivityTypeBrowsingWeb.true if the URL within the user activity was intended for the Facebook SDK, false otherwise.
addObserver(_:)
Registers an object to receive application lifecycle events (launch, open URL, background, foreground). Observers are held weakly.
The object to register. Must conform to
FBSDKApplicationObserving. The delegate holds a weak reference to this object.removeObserver(_:)
Removes a previously registered observer.
The observer to remove.
Usage example
Forward the relevantUIApplicationDelegate methods to ApplicationDelegate.shared from your app delegate:
If your app uses a
UISceneDelegate, forward the same calls from the scene delegate’s lifecycle methods instead of from AppDelegate.