62

I am following the Flutter Test Drive tutorial on the Flutter Docs. I installed XCode, cocoapods, ran pods setup etc.

However, in Android Studio, when I try to run IOS by clicking "Run IOS Simulator," it opens the simulator but fails to connect.

I also tried doing this from the terminal. Opened an IOS emulator and then ran flutter run in the app folder in terminal. I got an error No devices attached.

Samet ÖZTOPRAK
  • 3,112
  • 3
  • 32
  • 33
Android Ninja
  • 811
  • 1
  • 6
  • 9

11 Answers11

212

Please check whether you installed the latest version of Xcode.

After the installation, try to run the following command.

sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
Ali Abbas
  • 1,415
  • 12
  • 19
MUHAMMED IQBAL PA
  • 3,152
  • 2
  • 15
  • 23
33

As other people have suggested, it happens when you update XCode. So, run the command in terminal suggested by Muhammed

sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer

Then, you probably have to run flutter clean. For it to run properly.

Asesha George
  • 2,232
  • 2
  • 32
  • 68
Diego Ramírez
  • 430
  • 4
  • 4
27

I ran into the same problem but unfortunately, @MUHAMMED IQBAL PA's solution didn't suffice. Running these two commands, however, resolved the problem:

  1. As pointed out by others:

    sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
    
  2. :

    sudo xcodebuild -runFirstLaunch
    
Jimmy
  • 864
  • 13
  • 24
9

This error showed up after I updated my Xcode.

  1. Open Terminal
  2. Run the following command in Terminal

sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
  1. Enter your device's password.

Your IDE (Android Studio or IntelliJ) will detect the IOS Simulator as soon as you click return.

5

I fixed this problem by flowing these steps and refreshing the list of simulators

enter image description here

Abdullah Jacksi
  • 209
  • 6
  • 19
3

it happened to me when i have updated my Xcode, use this command to let Flutter recognize your Xcode again. sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer

Shashoug
  • 119
  • 1
  • 9
3

I have to use three steps:

running this two commands :

1) sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer

2) flutter clean

3)

I have to select on Android studio Ide - (on the simulator select button drop down left hand side of main.dart showing) I have to select "Open IOS emulator".

Then the simulator run. And the simulator was Auto select on the emulator selected section.

I have used Android Studio Bumble Bee and Xcode 13.

The summary is, I think, I have to open the simulator first, then its come to online with Android studio.

enter image description here

Noor Hossain
  • 1,620
  • 1
  • 18
  • 25
1

I came across this problem on my MacBook.

iOS toolchain - develop for iOS devices (Xcode 8.2.1) ✗ Flutter requires a minimum Xcode version of 9.0.0. Download the latest version or update via the Mac App Store.

Xcode was not updated. That is why IOS simulators are not supported.

Samet ÖZTOPRAK
  • 3,112
  • 3
  • 32
  • 33
0

Also make sure that you have agreed to Xcode licenses via running the command,

sudo xcodebuild -license

Ashwin Balani
  • 745
  • 7
  • 19
0

I Fixed this issue like this:

  1. Open simulator
  2. Go to "Device" in menu
  3. Click "Erase all content and settings"

which this will delete all content and settings of the simulator but the problem of hide in the android studio devices will be fix.

Jess Chen
  • 3,136
  • 1
  • 26
  • 35
0

I had different issue why IOS simulator was not appearing in fresh installation - dart sdk was not configured. I've clicked run->run there it was showing that dart is not configured, I've added flutter/bin/cache/dart-sdk in config and after that iphone simulator has appeared. Of course I followed other steps: sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer sudo xcodebuild -runFirstLaunch

Mantas
  • 222
  • 1
  • 7