Load iOS dart bundle by URL fallback (#22997)

This commit is contained in:
Jenn Magder 2020-12-10 14:43:02 -08:00 committed by GitHub
parent bb81b954b9
commit 9df2157676
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -43,6 +43,11 @@ flutter::Settings FLTDefaultSettingsForBundle(NSBundle* bundle) {
if (bundle == nil) {
bundle = [NSBundle bundleWithIdentifier:[FlutterDartProject defaultBundleIdentifier]];
}
if (bundle == nil) {
// The bundle isn't loaded and can't be found by bundle ID. Find it by path.
bundle = [NSBundle bundleWithURL:[NSBundle.mainBundle.privateFrameworksURL
URLByAppendingPathComponent:@"App.framework"]];
}
if (bundle == nil) {
bundle = mainBundle;
}
@ -239,11 +244,16 @@ flutter::Settings FLTDefaultSettingsForBundle(NSBundle* bundle) {
bundle = [NSBundle bundleWithIdentifier:[FlutterDartProject defaultBundleIdentifier]];
}
if (bundle == nil) {
bundle = [NSBundle mainBundle];
// The bundle isn't loaded and can't be found by bundle ID. Find it by path.
bundle = [NSBundle bundleWithURL:[NSBundle.mainBundle.privateFrameworksURL
URLByAppendingPathComponent:@"App.framework"]];
}
NSString* flutterAssetsName = [bundle objectForInfoDictionaryKey:@"FLTAssetsPath"];
if (flutterAssetsName == nil) {
if (bundle == nil) {
bundle = [NSBundle mainBundle];
flutterAssetsName = @"Frameworks/App.framework/flutter_assets";
} else if (flutterAssetsName == nil) {
flutterAssetsName = @"flutter_assets";
}
return flutterAssetsName;
}