Skip to content

v0.31.0

Choose a tag to compare

@github-actions github-actions released this 14 Oct 08:49
· 94 commits to main since this release
ecf7881

0.31.0

  • Add a FacebookAutoInitEnabled Info.plist key (iOS) to defer SDK initialization (fixes #502, thanks @hell03610). register(with:) called ApplicationDelegate.shared.initializeSDK() unconditionally, before any Dart code runs, so apps that gate measurement on user consent had no way to prevent it. The collection flags do not cover this case: with FacebookAutoLogAppEventsEnabled and FacebookAdvertiserIDCollectionEnabled both false no app events are logged, but initialization still fetches gatekeeper, server and domain configuration from Meta and writes to UserDefaults. An absent key means true, so existing apps are unaffected; only an explicit false defers initialization. Settings.shared.graphAPIVersion is still set at registration, so the pinned Graph API version applies either way.
  • Add initializeSdk() to initialize the SDK from Dart once consent exists. iOS maps it to ApplicationDelegate.shared.initializeSDK(); Android maps it to FacebookSdk.fullyInitialize() for apps with com.facebook.sdk.AutoInitEnabled=false in the manifest (deliberately not setAutoInitEnabled(true), which the native SDK persists and which would override the manifest setting on later launches). The call is idempotent on both platforms.
  • iOS: the plugin now rejects calls made before the SDK is initialized with a PlatformException of code sdk_not_initialized (every method except initializeSdk and setGraphApiVersion), and ignores incoming App Link URLs until then. The native SDK crashes in debug builds and silently drops calls in release when it is unconfigured, and some lazily-read settings such as the app id would otherwise be cached as empty for the rest of the process. This only affects apps that set FacebookAutoInitEnabled to false. Note that the two platforms differ here: Android's AutoInitEnabled=false does not keep the SDK asleep (the app id and client token are still loaded at process start and plugin calls still work), it only skips fullyInitialize(). See the README's "Deferring SDK initialization" section and the new "Deferred initialization on iOS" known limitation.
  • The example app now turns automatic initialization off on both platforms and initializes the SDK from a consent button.