Skip to content

Commit

Permalink
ios: cleanup when detaching from engine. #181
Browse files Browse the repository at this point in the history
  • Loading branch information
wang-bin committed Nov 17, 2024
1 parent 9d02426 commit 9c935f6
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions darwin/Classes/FvpPlugin.mm
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ + (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar>*)registrar {
#endif
FlutterMethodChannel* channel = [FlutterMethodChannel methodChannelWithName:@"fvp" binaryMessenger:messenger];
FvpPlugin* instance = [[FvpPlugin alloc] initWithRegistrar:registrar];
[registrar publish:instance];
[registrar addMethodCallDelegate:instance channel:channel];
SetGlobalOption("MDK_KEY", "C03BFF5306AB39058A767105F82697F42A00FE970FB0E641D306DEFF3F220547E5E5377A3C504DC30D547890E71059BC023A4DD91A95474D1F33CA4C26C81B0FC73B00ACF954C6FA75898EFA07D9680B6A00FDF179C0A15381101D01124498AF55B069BD4B0156D5CF5A56DEDE782E5F3930AD47C8F40BFBA379231142E31B0F");
}
Expand Down Expand Up @@ -176,4 +177,8 @@ - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result {
}
}

// ios only, optional. called first in dealloc(texture registry is still alive). plugin instance must be registered via publish
- (void)detachFromEngineForRegistrar:(NSObject<FlutterPluginRegistrar> *)registrar {
players.clear();
}
@end

0 comments on commit 9c935f6

Please sign in to comment.