Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explicitly initialize FB iOS SDK per change in FB SDK 9.0. #99

Merged
merged 3 commits into from
Mar 25, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions ios/Classes/SwiftFacebookAppEventsPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ public class SwiftFacebookAppEventsPlugin: NSObject, FlutterPlugin {
public static func register(with registrar: FlutterPluginRegistrar) {
let channel = FlutterMethodChannel(name: "flutter.oddbit.id/facebook_app_events", binaryMessenger: registrar.messenger())
let instance = SwiftFacebookAppEventsPlugin()

// Required for FB SDK 9.0, as it does not initialize the SDK automatically any more.
// See: https://developers.facebook.com/blog/post/2021/01/19/introducing-facebook-platform-sdk-version-9/
// "Removal of Auto Initialization of SDK" section
instance.initializeSDK()

registrar.addMethodCallDelegate(instance, channel: channel)
}

Expand Down Expand Up @@ -176,4 +182,8 @@ public class SwiftFacebookAppEventsPlugin: NSObject, FlutterPlugin {
Settings.setAdvertiserTrackingEnabled(enabled)
result(nil)
}

public func initializeSDK() {
ApplicationDelegate.initializeSDK(nil)
}
}