Fix install for iOS simulator, and add ability to uninstall (#4223)
diff --git a/packages/flutter_tools/lib/src/ios/devices.dart b/packages/flutter_tools/lib/src/ios/devices.dart
index 321ab3a..c86cf80 100644
--- a/packages/flutter_tools/lib/src/ios/devices.dart
+++ b/packages/flutter_tools/lib/src/ios/devices.dart
@@ -124,21 +124,6 @@
}
@override
- bool installApp(ApplicationPackage app) {
- try {
- IOSApp iosApp = app;
- runCheckedSync(<String>[installerPath, '-i', iosApp.deviceBundlePath]);
- return true;
- } catch (e) {
- return false;
- }
- return false;
- }
-
- @override
- bool isSupported() => true;
-
- @override
bool isAppInstalled(ApplicationPackage app) {
try {
String apps = runCheckedSync(<String>[installerPath, '--list-apps']);
@@ -152,6 +137,36 @@
}
@override
+ bool installApp(ApplicationPackage app) {
+ IOSApp iosApp = app;
+ Directory bundle = new Directory(iosApp.deviceBundlePath);
+ if (!bundle.existsSync()) {
+ printError("Could not find application bundle at ${bundle.path}; have you run 'flutter build ios'?");
+ return false;
+ }
+
+ try {
+ runCheckedSync(<String>[installerPath, '-i', iosApp.deviceBundlePath]);
+ return true;
+ } catch (e) {
+ return false;
+ }
+ }
+
+ @override
+ bool uninstallApp(ApplicationPackage app) {
+ try {
+ runCheckedSync(<String>[installerPath, '-U', app.id]);
+ return true;
+ } catch (e) {
+ return false;
+ }
+ }
+
+ @override
+ bool isSupported() => true;
+
+ @override
Future<LaunchResult> startApp(
ApplicationPackage app,
BuildMode mode, {
@@ -174,8 +189,7 @@
// Step 2: Check that the application exists at the specified path.
IOSApp iosApp = app;
Directory bundle = new Directory(iosApp.deviceBundlePath);
- bool bundleExists = bundle.existsSync();
- if (!bundleExists) {
+ if (!bundle.existsSync()) {
printError('Could not find the built application bundle at ${bundle.path}.');
return new LaunchResult.failed();
}