Repository: flutter
Issue: "flutter attach" command shows the error "The mDNS query for an attached iOS device failed." with iOS simulator but debugging and the hot reload work.
Labels: platform-ios,tool,has reproducible steps,P2,found in release: 2.5,found in release: 2.6,team-ios,triaged-ios

# Overview
Run `flutter attach` **before** running an application, the command shows  the following error every time. However, debugging and hot reload worked.
```
The mDNS query for an attached iOS device failed. It may be necessary to disable the "Personal Hotspot" on the
device, and to ensure that the "Disable unless needed" setting is unchecked under System Preferences > Network >
iPhone USB. See https://github.com/flutter/flutter/issues/46698 for details.
```
The error does not happen when I run the command **after** launching the application. I'm not sure what this error affects. Are there any problems?

# How to reproduce
```
flutter create my_app
cd my_app
flutter pub get
# open iOS simulator 
flutter attach # show error
# cmd-R in Runner projects
```
<details>
<summary> flutter doctor -v </summary>

```
➜  flutter_module git:(master) flutter doctor -v
[✓] Flutter (Channel stable, 2.5.0, on macOS 11.3.1 20E241 darwin-x64, locale ja-JP)
    • Flutter version 2.5.0 at /Users/01036096/fvm/versions/2.5.0
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 4cc385b4b8 (2 weeks ago), 2021-09-07 23:01:49 -0700
    • Engine revision f0826da7ef
    • Dart version 2.14.0

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /Users/01036096/Library/Android/sdk
    • Platform android-30, build-tools 30.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode12.5.app/Contents/Developer
    • Xcode 12.5, Build version 12E262
    • CocoaPods version 1.10.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264)

[✓] VS Code (version 1.60.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.26.0

[✓] Connected device (2 available)
    • iPod touch (7th generation) (mobile) • 0EC51244-1A49-4424-8F65-95392BFE6C63 • ios            •
      com.apple.CoreSimulator.SimRuntime.iOS-14-5 (simulator)
    • Chrome (web)                         • chrome                               • web-javascript • Google
      Chrome 93.0.4577.82

• No issues found!
```

</details>

# Background

When I debug an add-to-app application, I use `flutter attach` command. Every time the following error shows when I run the command **before** launching an application. On the other hand, `flutter attach` **after** launching the application does not show the error. (According to the [documentation](https://flutter.dev/docs/development/add-to-app/debugging#debugging), `flutter attach` works both before and after the application is launched)

<details>
<summary>  error message  </summary>

```
➜  flutter_module git:(master) flutter attach
The mDNS query for an attached iOS device failed. It may be necessary to disable the "Personal Hotspot" on the
device, and to ensure that the "Disable unless needed" setting is unchecked under System Preferences > Network >
iPhone USB. See https://github.com/flutter/flutter/issues/46698 for details.
Waiting for a connection from Flutter on iPod touch (7th generation)...
Syncing files to device iPod touch (7th generation)...              8.0s

Flutter run key commands.
r Hot reload. 🔥🔥🔥
R Hot restart.
h List all available interactive commands.
d Detach (terminate "flutter run" but leave application running).
c Clear the screen
q Quit (terminate the application on the device).

💪 Running with sound null safety 💪

An Observatory debugger and profiler on iPod touch (7th generation) is available at:
http://127.0.0.1:55998/dzjYn6oEDvc=/
The Flutter DevTools debugger and profiler on iPod touch (7th generation) is available at:
http://127.0.0.1:9100?uri=http://127.0.0.1:55998/dzjYn6oEDvc=/
```

</details>

Regardless of whether there is the error or not, debugging with AndroidStudio, hot reload and hot restart worked. 

Referring to the issue https://github.com/flutter/flutter/issues/46698, I tried to change the device configuration. But, the iOS simulator does not have `Personal Hotspot` configurations. 

I guess that debugging, hot reload and hot restart do not work when mDNS query failed according to the following issues:
- https://github.com/flutter/flutter/issues/41085
- https://github.com/flutter/flutter/issues/46705#issuecomment-575652695

However, as I mentioned, debugging worked. So I'm not sure what this error affects. Are there any problems?

# Related Issue

https://github.com/flutter/flutter/issues/23164#issuecomment-631918915 is a similar situation. But there is no solution.