Fix bundle id on iOS launch using flutter run (#31039)
This commit is contained in:
committed by
Jonah Williams
parent
6a1468db16
commit
74c6237abc
@@ -23,6 +23,7 @@ import '../project.dart';
|
||||
import '../protocol_discovery.dart';
|
||||
import 'ios_workflow.dart';
|
||||
import 'mac.dart';
|
||||
import 'plist_utils.dart';
|
||||
|
||||
const String _xcrunPath = '/usr/bin/xcrun';
|
||||
|
||||
@@ -343,7 +344,15 @@ class IOSSimulator extends Device {
|
||||
|
||||
// Launch the updated application in the simulator.
|
||||
try {
|
||||
await SimControl.instance.launch(id, package.id, args);
|
||||
// Use the built application's Info.plist to get the bundle identifier,
|
||||
// which should always yield the correct value and does not require
|
||||
// parsing the xcodeproj or configuration files.
|
||||
// See https://github.com/flutter/flutter/issues/31037 for more information.
|
||||
final IOSApp iosApp = package;
|
||||
final String plistPath = fs.path.join(iosApp.simulatorBundlePath, 'Info.plist');
|
||||
final String bundleIdentifier = iosWorkflow.getPlistValueFromFile(plistPath, kCFBundleIdentifierKey);
|
||||
|
||||
await SimControl.instance.launch(id, bundleIdentifier, args);
|
||||
} catch (error) {
|
||||
printError('$error');
|
||||
return LaunchResult.failed();
|
||||
|
||||
Reference in New Issue
Block a user