Here's my Environment
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.
You need to go to your Settings > General > Device Management. Inside Device Management, select the developer name and tap Trust “YOUR DEVELOPER NAME”. You should now be able to run your Flutter app on your local device.
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).
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.
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 :
Ok
flutter clean
& flutter build ios
& try running again
—
— 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
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 !
run flutter run -d yourDeviceID
Have fun ! Press r in Terminal for HotReload⚡️
If you need to find your iOS device ID :
Select Add Additional Simulators
Select your device & run
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With