fix: override stale Graph API version in Facebook SDK v18.x#476
fix: override stale Graph API version in Facebook SDK v18.x#476DennisAlund wants to merge 2 commits intomainfrom
Conversation
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]>
There was a problem hiding this comment.
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.
| Future<void> setGraphApiVersion(String version) { | ||
| return _channel.invokeMethod<void>('setGraphApiVersion', version); | ||
| } |
There was a problem hiding this comment.
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'),
);
});
Fixes #474
Summary
The Facebook SDK v18.x ships with outdated default Graph API versions that Meta has already removed:
v17.0v16.0There 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):
Settings.shared.graphAPIVersion = "v24.0"immediately afterinitializeSDK()in plugin registrationFacebookSdk.setGraphApiVersion("v24.0")inonAttachedToEnginev24.0was 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().README: Added a "Graph API Version" section under Known Limitations documenting the workaround, the version table, and usage example.