18

Here's my Environment

  • Xcode Version: 11.1 (11A1027)
  • Physical device: - iPad mini 2 (IOS 12.4.2)
  • VSCode Version: 1.39.2
  • Flutter version: 1.9.1+hotfix.6

When I use the iOS part of the Flutter project and run it physical device using XCode, it detects the device and works fine but I am somehow not able to see the device on the available devices section on VSCode.

However VSCode detects and works fine with the simulator.

I also ran flutter doctor to see connected devices, but again it does not show the connected physical devices but shows the simulator created device.

Zonily Jame
  • 5,053
  • 3
  • 30
  • 56
harpreet seera
  • 1,620
  • 1
  • 7
  • 15

8 Answers8

24

Use rm -rf <flutter_repo_directory>/bin/cache to force delete the files in cache and then flutter doctor -v to reinstall the missing sdk directories.

Deleting the cache in flutter/bin/cache directory and then reinstalling the dart sdk solved this issue.

Referred to this issue in Flutter repository(Issue No:41006).

harpreet seera
  • 1,620
  • 1
  • 7
  • 15
14

I had the same issue. In my case, a recent iOS update had turned off Developer mode, for some reason... So I needed to enable it again (Settings - Privacy & Security - Developer Mode).

5

All I had to do was to disconnect the device from the laptop, make sure VS Code is open, then connect the device again while no VS Code, then it detected right away and chose the device automatically.

esengineer
  • 9,514
  • 7
  • 45
  • 69
3

iPadOS / iOS Devices Setup for Hot Reload

Before trying to flutter Debug on physical device from Vscode it is Required to first :

Run a successful Xcode build on that iOS or iPadOS device

Follow this steps if you don't know how to Run Xcode Build -> your device should then be detected by flutter :

  1. Open Xcode & do all the classic Set Up (Signing in with a Team & choosing a UNIQUE bundle Identifier)

S.Shot Xcode Signing & Capabilities

  1. Set Your iPhone Auto-Lock to Never (& Unlock it !) - Connect your iPhone or iPad to Mac with USB cable & Accept Prompt on the iPhone

S.Shot iPhone Prompt

  1. Run Xcode Build on your iPhone S.Shot Xcode Could not Launch Runner this alert prompt will select Ok
  2. On your iPhone a new menu will have appeared - Navigate to it & Click « Verify App » or « Accept »
  3. Now Run Xcode Build Again - if does not run try running flutter clean & flutter build ios & try running again

  1. After Successful Xcode Build - Stop Running the App
  2. Keep Xcode Open

iOS Setup is done

Close all Simulators or Emulators - Close VsCode

run flutter devices to make sure your Device is now detected

if it’s not try Turning it off & plugging it back again - remember to accept Trust Computer Prompt - keep it device unlocked too !


Open back your project in VsCode or Android Studio

Hot Reload⚡️Using VsCode :

Press F8 or Select ▷ « Start Debugging » in main.dart

That’s it ! You now have the power of Hot Reload⚡️ with VsCode on a physical device !

Hot Reload using Terminal Commands :

run flutter run -d yourDeviceID

Have fun ! Press r in Terminal for HotReload⚡️

If you need to find your iOS device ID :

Picture of Menu to find Device ID

Select Add Additional Simulators

Picture Device ID

Hot Reload⚡️on Android Studio :

Select your device & run

Aristidios
  • 1,921
  • 2
  • 13
  • 24
1

Sometimes it doesn't detect the device if it is not directly connected to the computer. I had a docking station in between and it didn't recognized the device. Especially after you have updated you macOS just before.

Cyber
  • 2,194
  • 4
  • 22
  • 41
1

With "focus mode" activated on the device (like "do not disturb" ) it won't show up.

0

Check whether you have fully installed xcode by running flutter doctor -v Incase you find that some thing like

[!] Xcode - develop for iOS and macOS ✗ Xcode installation is incomplete; a full installation is necessary for iOS development. Download at: https://developer.apple.com/xcode/download/ Or install Xcode via the App Store.

just run install Xcode and run sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer sudo xcodebuild -runFirstLaunch Incase you installed xcode already, just run the above commands, they will do the magic.

0

If you feel code is downloaded completely and no issue with flutter SDK and tried redownloading the flutter cache files, then check your Xcode path

To switch the Xcode path use

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

Also make sure your Xcode is in application folder

PRATHIV
  • 352
  • 2
  • 10