Ive been having issues with connecting my flutter app ios simulator from xcode to my localhost backend,
i can however connect the android device to localhsot(using 10.0.2.2)
i have a settings.dart for the apis,
i have tried to connect the ios simulator with: localhost:8000, 127.0.0.1:8000 or my current ip.
abstract class BaseConfig {
String get ipServer;
String get apiHost;
}
class DevConfig implements BaseConfig {
String get ipServer => 'localhost:8000';
String get apiHost => 'http://localhost:8000/';
}
this is my flutter doctor:
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.22.2, on macOS 14.5 23F79 darwin-arm64, locale en-MX)
[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 15.4)
[✗] Chrome - develop for the web (Cannot find Chrome executable at /Applications/Google
Chrome.app/Contents/MacOS/Google Chrome)
! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[✓] Android Studio (version 2024.1)
[✓] VS Code (version 1.90.2)
[✓] Connected device (4 available)
[✓] Network resources
The ways ive tried to run this with xcode i open the app with open ios/Runner.xcworkspace , then i make sure there is a simulator set up then i open it with open -a Simulator, everything opens correctly, then ive try to just run flutter run or right click main.dart and run without debug, and nothing works, the app opens correctly and i even log the ip fetch locations:
I/flutter (13694): You are running in LOCAL Environment
I/flutter (13694): Services Fecthing from URL: http://localhost:8000/
still it just wont fetch them from the backend.
Andres is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.