Load macOS dart bundle by URL fallback (flutter/engine#22979)

This commit is contained in:
Jenn Magder 2020-12-10 12:50:58 -08:00 committed by GitHub
parent f128a93e70
commit 99bfdc65ed

View File

@ -27,6 +27,11 @@ static NSString* const kAppBundleIdentifier = @"io.flutter.flutter.app";
NSAssert(self, @"Super init cannot be nil");
_dartBundle = bundle ?: [NSBundle bundleWithIdentifier:kAppBundleIdentifier];
if (_dartBundle == nil) {
// The bundle isn't loaded and can't be found by bundle ID. Find it by path.
_dartBundle = [NSBundle bundleWithURL:[NSBundle.mainBundle.privateFrameworksURL
URLByAppendingPathComponent:@"App.framework"]];
}
_dartEntrypointArguments = [[NSProcessInfo processInfo] arguments];
// Remove the first element as it's the binary name
_dartEntrypointArguments = [_dartEntrypointArguments