Since updating to iOS (I think ?), I’m running into this error message when running my app on my iPhone:
Could not run build/ios/iphoneos/Runner.app on XXXXX.
Try launching Xcode and selecting "Product > Run" to fix the problem:
open ios/Runner.xcworkspace
Error launching application on iPhone.
I have tried to run it using both Android Studio and the terminal, in both case it’s not working unless I run it the app on the simulator. For physical devices, it only runs from XCode, but that doesn’t provide debug logs.
I have tried:
- Uninstalling the app from the phone
- Forgetting trusted computers from the phone, and trusting the mac again
- Flutter clean -> Flutter run
- XCode -> Product -> Clean Build Folder -> Flutter run
- flutter run -d device_id
- checking on the phone’s General -> VPN & Device Management, there’s nothing
- clearing
rm -rf ~/flutter/bin/cache/artifacts/
, clearing XCode derived data
Nothing worked. Help !
Flutter doctor
[!] Flutter (Channel unknown, 3.7.12, on macOS 13.6 22G120 darwin-arm64, locale fr-FR)
! Flutter version 3.7.12 on channel unknown at /opt/homebrew/Caskroom/flutter/3.3.5/flutter
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
[✓] Xcode - develop for iOS and macOS (Xcode 15.0)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2022.3)
[✓] IntelliJ IDEA Community Edition (version 2022.2.3)
[✓] VS Code (version 1.83.0)
[✓] Connected device (5 available)
[✓] HTTP Host Availability
Running flutter 3.7 instead of 3.10 is normal, as some of the plugin I use induce errors for flutter 3.10 and I haven’t had the time to correct that. Shouldn’t affect anything though since it runs fine from XCode. I’m running XCode 15.0.
2
Answers
Need to update flutter version to 3.13 or later. Looks like Xcode change the ios dev directory path (up to 16.4 for now) and implement an new method for it. For now, each time the ide(VSCode or Intellij IDEA) will call Xcode when you are debugging. And turn off Cisco Anyconnect if you have. Xcode need your devices in in the same WiFi.
This has not been fixed in flutter 3.13. I am using 3.13.9 and the issue is still presenting, e.g., have to switch to XCode from cmd-line to run on device (iOS 17 & Xcode 15.x)