Repository: flutter
Issue: [tool] Proposal to add warning message if debug and profile builds fail with  "Error: iPhone is busy"
Labels: platform-ios,tool,c: proposal,a: error message,P3,team-ios,triaged-ios

I got "Error: iPhone is busy" and build was failing for me.
After i solved it ([see](https://stackoverflow.com/questions/46316373/fixing-xcode-9-issue-iphone-is-busy-preparing-debugger-support-for-iphone)), it ran successfully

I think it would be possible for us to check this before build and show a warning with instructions how to fix it and prompt whether they want to force continue the build (y/n), if that's reasonable

#### steps to reproduce

1. Somehow get the Error: iPhone is busy
2. `flutter run`, or `--profile` (but not `--release`, in release it ran successfully for me)

#### logs

<details>
<summary>flutter run / flutter run --profile</summary>

```
[   +3 ms] Installing and launching...
[        ] Debugging is enabled, connecting to observatory
[   +6 ms] executing: script -t 0 /dev/null /Users/danya/dev/src/flutter/bin/cache/artifacts/ios-deploy/ios-deploy --id
86b0b059a5210f26163e88a385ca2c87c7fc5115 --bundle build/ios/iphoneos/Runner.app --app_deltas build/ios/app-delta --debug --no-wifi --args
--enable-dart-profiling --disable-service-auth-codes --enable-checked-mode --verify-entry-points
[  +20 ms] [....] Waiting for iOS device to be connected
[  +27 ms] [....] Using 86b0b059a5210f26163e88a385ca2c87c7fc5115 (D101AP, iPhone 7, iphoneos, arm64) a.k.a. 'iPhone (Daniil)'.
[        ] ------ Install phase ------
[        ] [  0%] Found 86b0b059a5210f26163e88a385ca2c87c7fc5115 (D101AP, iPhone 7, iphoneos, arm64) a.k.a. 'iPhone (Daniil)' connected through USB,
beginning install
[ +442 ms] [  5%] TransferringPackage
[        ] [  5%] Copying /Users/danya/dev/projects/app/build/ios/app-delta/Runner.app.T0BrXd/Runner.app_sparse.ipa/META-INF/ to device
[        ] [  7%] Copying
/Users/danya/dev/projects/app/build/ios/app-delta/Runner.app.T0BrXd/Runner.app_sparse.ipa/META-INF/com.apple.ZipMetadata.plist to device
[        ] [  9%] Copying /Users/danya/dev/projects/app/build/ios/app-delta/Runner.app.T0BrXd/Runner.app_sparse.ipa/Payload/ to device
[        ] [ 11%] Copying /Users/danya/dev/projects/app/build/ios/app-delta/Runner.app.T0BrXd/Runner.app_sparse.ipa/Payload/Runner.app/ to device
[        ] [ 13%] Copying
/Users/danya/dev/projects/app/build/ios/app-delta/Runner.app.T0BrXd/Runner.app_sparse.ipa/Payload/Runner.app/_CodeSignature/ to device
[        ] [ 15%] Copying
/Users/danya/dev/projects/app/build/ios/app-delta/Runner.app.T0BrXd/Runner.app_sparse.ipa/Payload/Runner.app/_CodeSignature/CodeResources to device
[   +5 ms] [ 21%] Copying /Users/danya/dev/projects/app/build/ios/app-delta/Runner.app.T0BrXd/Runner.app_sparse.ipa/Payload/Runner.app/Info.plist to
device
[        ] [ 24%] Copying /Users/danya/dev/projects/app/build/ios/app-delta/Runner.app.T0BrXd/Runner.app_sparse.ipa/Payload/Runner.app/Runner to
device
[   +1 ms] [ 42%] Copying
/Users/danya/dev/projects/app/build/ios/app-delta/Runner.app.T0BrXd/Runner.app_sparse.ipa/com.apple.deltainstallcommands.com.example.app to device
[        ] [ 44%] Copying /Users/danya/dev/projects/app/build/ios/app-delta/Runner.app.T0BrXd/Runner.app_sparse.ipa/Payload/Runner.app/PkgInfo to
device
[        ] [ 46%] Copying /Users/danya/dev/projects/app/build/ios/app-delta/Runner.app.T0BrXd/Runner.app_sparse.ipa/ManifestCache.plist to device
[  +60 ms] [ 52%] CreatingStagingDirectory
[        ] [ 57%] ExtractingPackage
[        ] [ 60%] InspectingPackage
[  +59 ms] [ 60%] TakingInstallLock
[ +121 ms] [ 65%] PreflightingApplication
[        ] [ 67%] PatchingApplication
[ +123 ms] [ 67%] InstallingEmbeddedProfile
[   +5 ms] [ 70%] VerifyingApplication
[  +53 ms] [ 75%] CreatingContainer
[   +8 ms] [ 80%] InstallingApplication
[  +10 ms] [ 85%] PostflightingApplication
[   +2 ms] [ 90%] SandboxingApplication
[  +10 ms] [ 95%] GeneratingApplicationMap
[ +335 ms] [100%] Installed package build/ios/iphoneos/Runner.app
[ +164 ms] ------ Debug phase ------
[        ] Starting debug of 86b0b059a5210f26163e88a385ca2c87c7fc5115 (D101AP, iPhone 7, iphoneos, arm64) a.k.a. 'iPhone (Daniil)' connected through
USB...
[ +152 ms] [  0%] Looking up developer disk image
[  +42 ms] [ 95%] Developer disk image mounted successfully
[ +354 ms] [100%] Connecting to remote debug server
[        ] -------------------------
[  +43 ms] (lldb) command source -s 0 '/tmp/C7198193-43F9-41EB-8174-B3271A240E78/fruitstrap-lldb-prep-cmds-86b0b059a5210f26163e88a385ca2c87c7fc5115'
[        ] Executing commands in '/tmp/C7198193-43F9-41EB-8174-B3271A240E78/fruitstrap-lldb-prep-cmds-86b0b059a5210f26163e88a385ca2c87c7fc5115'.
[        ] (lldb)     platform select remote-ios --sysroot '/Users/danya/Library/Developer/Xcode/iOS DeviceSupport/14.3 (18C66)/Symbols'
[        ]   Platform: remote-ios
[        ]  Connected: no
[        ]   SDK Path: "/Users/danya/Library/Developer/Xcode/iOS DeviceSupport/14.3 (18C66)/Symbols"
[        ] (lldb)     target create "/Users/danya/dev/projects/app/build/ios/iphoneos/Runner.app"
[ +481 ms] Current executable set to '/Users/danya/dev/projects/app/build/ios/iphoneos/Runner.app' (arm64).
[        ] (lldb)     script fruitstrap_device_app="/private/var/containers/Bundle/Application/3A6B38A9-7639-4647-B15B-D710C3005765/Runner.app"
[ +305 ms] (lldb)     script fruitstrap_connect_url="connect://127.0.0.1:49560"
[        ] (lldb)     script fruitstrap_output_path=""
[        ] (lldb)     script fruitstrap_error_path=""
[        ] (lldb)     target modules search-paths add /usr "/Users/danya/Library/Developer/Xcode/iOS DeviceSupport/14.3 (18C66)/Symbols/usr" /System
"/Users/danya/Library/Developer/Xcode/iOS DeviceSupport/14.3 (18C66)/Symbols/System"
"/private/var/containers/Bundle/Application/3A6B38A9-7639-4647-B15B-D710C3005765" "/Users/danya/dev/projects/app/build/ios/iphoneos"
"/var/containers/Bundle/Application/3A6B38A9-7639-4647-B15B-D710C3005765" "/Users/danya/dev/projects/app/build/ios/iphoneos" /Developer
"/Users/danya/Library/Developer/Xcode/iOS DeviceSupport/14.3 (18C66)/Symbols/Developer"
[   +7 ms] (lldb)     command script import "/tmp/C7198193-43F9-41EB-8174-B3271A240E78/fruitstrap_86b0b059a5210f26163e88a385ca2c87c7fc5115.py"
[   +4 ms] (lldb)     command script add -f fruitstrap_86b0b059a5210f26163e88a385ca2c87c7fc5115.connect_command connect
[        ] (lldb)     command script add -s asynchronous -f fruitstrap_86b0b059a5210f26163e88a385ca2c87c7fc5115.run_command run
[        ] (lldb)     command script add -s asynchronous -f fruitstrap_86b0b059a5210f26163e88a385ca2c87c7fc5115.autoexit_command autoexit
[        ] (lldb)     command script add -s asynchronous -f fruitstrap_86b0b059a5210f26163e88a385ca2c87c7fc5115.safequit_command safequit
[        ] (lldb)     connect
[  +60 ms] (lldb)     run
[ +245 ms] success
[        ] Application launched on the device. Waiting for observatory port.
[+30019 ms] Installing and launching... (completed in 33,2s)
[        ] Error launching application on iPhone (Daniil).
[   +4 ms] "flutter run" took 50 554ms.
[   +3 ms] 
           #0      throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
           #1      RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:658:9)
           <asynchronous suspension>
           #2      FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1036:27)
           <asynchronous suspension>
           #3      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:152:19)
           <asynchronous suspension>
           #4      CommandRunner.runCommand (package:args/command_runner.dart:197:13)
           <asynchronous suspension>
           #5      FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:283:9)
           <asynchronous suspension>
           #6      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:152:19)
           <asynchronous suspension>
           #7      FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:239:5)
           <asynchronous suspension>
           #8      run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:62:9)
           <asynchronous suspension>
           #9      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:152:19)
           <asynchronous suspension>
           #10     main (package:flutter_tools/executable.dart:92:3)
           <asynchronous suspension>
           
           
[   +1 ms] ensureAnalyticsSent: 0ms
[        ] Running shutdown hooks
[   +2 ms] Shutdown hooks complete
[        ] (lldb) process detach
[        ] exiting with code 1
```

</details>

<details>
<summary>flutter doctor -v</summary>

```
[✓] Flutter (Channel nt4f04und, 2.1.0-13.0.pre.86, on macOS 11.2.3 20D91 darwin-x64, locale ru-RU)
    • Flutter version 2.1.0-13.0.pre.86 at /Users/danya/dev/src/flutter
    • Framework revision 40e3489254 (5 hours ago), 2021-03-13 17:43:03 -0500
    • Engine revision 9ec46417bd
    • Dart version 2.13.0 (build 2.13.0-134.0.dev)

[✗] Android toolchain - develop for Android devices
    ✗ Unable to locate Android SDK.
      Install Android Studio from: https://developer.android.com/studio/index.html
      On first launch it will assist you in installing the Android SDK components.
      (or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions).
      If the Android SDK has been installed to a custom location, please use
      `flutter config --android-sdk` to update to that location.


[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.4, Build version 12D4e
    • CocoaPods version 1.10.0

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[!] Android Studio (not installed)
    • Android Studio not found; download from https://developer.android.com/studio/index.html
      (or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions).

[✓] VS Code (version 1.54.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.20.0

[✓] Connected device (2 available)
    • iPhone (Daniil) (mobile) • 86b0b059a5210f26163e88a385ca2c87c7fc5115 • ios            • iOS 14.3
    • Chrome (web)             • chrome                                   • web-javascript • Google Chrome 89.0.4389.82
    ! Error: iPhone (Daniil) is busy: Copying cache files from device. Xcode will continue when iPhone (Daniil) is finished. (code -10)

! Doctor found issues in 2 categories.
```

</details>


cc @jonahwilliams