Skip to content

Commit 783530c

Browse files
Kobikg78claude
andcommitted
fix(ios): guard FlutterSceneLifeCycleDelegate with compile-time check
Instead of hard-requiring Flutter >=3.38.0, wrap FlutterSceneLifeCycleDelegate protocol adoption and addSceneDelegate with #if __has_include guards. - Flutter >=3.38 (header present): UIScene delegate registered, all three scene callbacks active — deep links work under UIScene migration. - Flutter <3.38 (header absent): guard skips it at compile time, plugin falls back to application:openURL: — backward compatible. pubspec.yaml reverts flutter constraint to >=1.10.0 (no breaking change). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 680bd7b commit 783530c

3 files changed

Lines changed: 9 additions & 1 deletion

File tree

ios/Classes/AppsflyerSdkPlugin.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@
66
#import "AppsFlyerLib.h"
77
#endif
88

9+
#if __has_include(<Flutter/FlutterSceneLifeCycleDelegate.h>)
910
@interface AppsflyerSdkPlugin: NSObject<FlutterPlugin, FlutterSceneLifeCycleDelegate>
11+
#else
12+
@interface AppsflyerSdkPlugin: NSObject<FlutterPlugin>
13+
#endif
1014

1115
@property (readwrite, nonatomic) BOOL isManualStart;
1216

ios/Classes/AppsflyerSdkPlugin.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,11 @@ + (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar>*)registrar {
6868
[registrar addMethodCallDelegate:instance channel:channel];
6969
[registrar addMethodCallDelegate:instance channel:callbackChannel];
7070
[registrar addApplicationDelegate:instance];
71+
#if __has_include(<Flutter/FlutterSceneLifeCycleDelegate.h>)
7172
if (@available(iOS 13.0, *)) {
7273
[registrar addSceneDelegate:instance];
7374
}
75+
#endif
7476

7577
}
7678

@@ -965,6 +967,7 @@ - (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserAct
965967
return NO;
966968
}
967969

970+
#if __has_include(<Flutter/FlutterSceneLifeCycleDelegate.h>)
968971
#pragma mark - FlutterSceneLifeCycleDelegate
969972

970973
// UIScene-based URI-scheme deep links (iOS 13+, Flutter 3.41+ UIScene migration)
@@ -990,6 +993,7 @@ - (BOOL)scene:(UIScene*)scene continueUserActivity:(NSUserActivity*)userActivity
990993
[[AppsFlyerAttribution shared] continueUserActivity:userActivity restorationHandler:nil];
991994
return NO;
992995
}
996+
#endif // __has_include(<Flutter/FlutterSceneLifeCycleDelegate.h>)
993997

994998

995999
@end

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ homepage: https://github.com/AppsFlyerSDK/flutter_appsflyer_sdk
66

77
environment:
88
sdk: '>=2.17.0 <4.0.0'
9-
flutter: ">=3.38.0"
9+
flutter: ">=1.10.0"
1010

1111
dependencies:
1212
flutter:

0 commit comments

Comments
 (0)