diff --git a/shell/platform/darwin/macos/framework/Source/FlutterDartProject.mm b/shell/platform/darwin/macos/framework/Source/FlutterDartProject.mm index 6343729d09ac7..0716c1a2ddc24 100644 --- a/shell/platform/darwin/macos/framework/Source/FlutterDartProject.mm +++ b/shell/platform/darwin/macos/framework/Source/FlutterDartProject.mm @@ -27,6 +27,11 @@ - (instancetype)initWithPrecompiledDartBundle:(NSBundle*)bundle { 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