Fix bundle id on iOS launch using flutter run (#31039)

This commit is contained in:
Victor Maraccini
2019-05-01 14:21:43 -03:00
committed by Jonah Williams
parent 6a1468db16
commit 74c6237abc
2 changed files with 41 additions and 1 deletions

View File

@@ -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();