Skip to content

Commit 218712e

Browse files
authored
Merge pull request #221 from LinXunFeng/fix_ios_crash
fix crash when killing app on iOS
2 parents 5ec7307 + 457d8f8 commit 218712e

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

darwin/Classes/FvpPlugin.mm

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,10 @@ + (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar>*)registrar {
135135
#endif
136136
FlutterMethodChannel* channel = [FlutterMethodChannel methodChannelWithName:@"fvp" binaryMessenger:messenger];
137137
FvpPlugin* instance = [[FvpPlugin alloc] initWithRegistrar:registrar];
138+
#if TARGET_OS_OSX
139+
#else
140+
[registrar addApplicationDelegate:instance];
141+
#endif
138142
[registrar publish:instance];
139143
[registrar addMethodCallDelegate:instance channel:channel];
140144
SetGlobalOption("MDK_KEY", "C03BFF5306AB39058A767105F82697F42A00FE970FB0E641D306DEFF3F220547E5E5377A3C504DC30D547890E71059BC023A4DD91A95474D1F33CA4C26C81B0FC73B00ACF954C6FA75898EFA07D9680B6A00FDF179C0A15381101D01124498AF55B069BD4B0156D5CF5A56DEDE782E5F3930AD47C8F40BFBA379231142E31B0F");
@@ -183,4 +187,11 @@ - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result {
183187
- (void)detachFromEngineForRegistrar:(NSObject<FlutterPluginRegistrar> *)registrar {
184188
players.clear();
185189
}
190+
191+
#if TARGET_OS_OSX
192+
#else
193+
- (void)applicationWillTerminate:(UIApplication *)application {
194+
players.clear();
195+
}
196+
#endif
186197
@end

0 commit comments

Comments
 (0)