Skip to content

fix: override stale Graph API version in Facebook SDK v18.x#476

Open
DennisAlund wants to merge 2 commits intomainfrom
issues/474-meta-graph-api-deprecation
Open

fix: override stale Graph API version in Facebook SDK v18.x#476
DennisAlund wants to merge 2 commits intomainfrom
issues/474-meta-graph-api-deprecation

Conversation

@DennisAlund
Copy link
Member

@DennisAlund DennisAlund commented Feb 25, 2026

Fixes #474

Summary

The Facebook SDK v18.x ships with outdated default Graph API versions that Meta has already removed:

Platform SDK default Removed by Meta
iOS SDK v18.x v17.0 September 12, 2025
Android SDK v18.x v16.0 May 14, 2025

There is no SDK v19.x yet — v18.x is the current release for both platforms. This is a confirmed upstream bug with open issues but no committed fix timeline from Meta:

Changes

Transparent fix (no app changes required):

  • iOS: set Settings.shared.graphAPIVersion = "v24.0" immediately after initializeSDK() in plugin registration
  • Android: call FacebookSdk.setGraphApiVersion("v24.0") in onAttachedToEngine

v24.0 was chosen as the default — released October 2025, stable, with ~20 months of runway before expected deprecation (~Oct 2027).

New setGraphApiVersion(String version) API:

Exposes control for apps that need to target a specific Graph API version. Must be called before activateApp().

await facebookAppEvents.setGraphApiVersion('v24.0');
await facebookAppEvents.activateApp();

README: Added a "Graph API Version" section under Known Limitations documenting the workaround, the version table, and usage example.

DennisAlund and others added 2 commits February 25, 2026 13:43
Facebook SDK v18.x ships with an outdated default Graph API version
that Meta has already removed (iOS: v17.0 removed Sep 2025, Android:
v16.0 removed May 2025). There is no SDK v19.x yet; this is a known
upstream issue with no Meta-provided fix.

This commit applies two changes to resolve #474:

- Override the default to v24.0 at plugin initialization on both
  iOS (Settings.shared.graphAPIVersion) and Android
  (FacebookSdk.setGraphApiVersion). This is transparent and requires
  no app-level changes.

- Expose setGraphApiVersion(String version) in the Flutter API for
  apps that need to target a specific version. Must be called before
  activateApp() to take effect.

Upstream issues:
  facebook/facebook-ios-sdk#2610
  facebook/facebook-android-sdk#1308

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Add a "Graph API Version" section to the Known Limitations chapter
explaining why the plugin overrides the Facebook SDK default and how
to use setGraphApiVersion() for apps that need version control.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Copilot AI review requested due to automatic review settings February 25, 2026 05:45
@DennisAlund DennisAlund self-assigned this Feb 25, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request addresses a critical issue where the Facebook SDK v18.x ships with outdated Graph API versions that Meta has already removed (v17.0 for iOS, removed September 12, 2025; v16.0 for Android, removed May 14, 2025). The PR implements a transparent fix by automatically overriding the Graph API version to v24.0 during plugin initialization, and also exposes a new setGraphApiVersion API for apps that need to target a specific version.

Changes:

  • Automatic override to Graph API v24.0 at plugin initialization on both iOS and Android platforms
  • New setGraphApiVersion(String version) method for manual version control
  • Comprehensive README documentation explaining the issue, workaround, and usage

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
lib/facebook_app_events.dart Adds new setGraphApiVersion method with detailed documentation explaining when and why to use it
ios/facebook_app_events/Sources/facebook_app_events/FacebookAppEventsPlugin.swift Sets Settings.shared.graphAPIVersion = "v24.0" after SDK initialization and implements handleSetGraphApiVersion method handler
android/src/main/kotlin/id/oddbit/flutter/facebook_app_events/FacebookAppEventsPlugin.kt Calls FacebookSdk.setGraphApiVersion("v24.0") in onAttachedToEngine and implements handleSetGraphApiVersion method handler
README.md Adds "Graph API Version" section under Known Limitations with table, explanation, usage example, and references to upstream issues

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +517 to +519
Future<void> setGraphApiVersion(String version) {
return _channel.invokeMethod<void>('setGraphApiVersion', version);
}
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new setGraphApiVersion method lacks test coverage. Based on the existing test patterns in test/facebook_app_events_test.dart, there should be at least one test verifying that the method correctly invokes the platform channel with the expected method name and version argument. For example:

test('setGraphApiVersion forwards version string', () async {
  await facebookAppEvents.setGraphApiVersion('v24.0');
  expect(
    methodCall,
    isMethodCall('setGraphApiVersion', arguments: 'v24.0'),
  );
});

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Meta's Deprecation Timeline (Graph API V17.0)

2 participants