Search code examples
iosflutterapple-appclips

Flutter App Clip cannot make api requests


DioException [connection error]: The connection errored: Connection failed flutter: │ 🐛 Error: SocketException: Connection failed (OS Error: No route to host, errno = 65)

The error only occurs when building App Clip on real device, There is no such problem on simulator with the App Clip

Tested Devices:
  • iPhone 11 running iOS 17.0.1
  • iPhone XR running iOS 17.0.0
[✓] Flutter (Channel stable, 3.13.0, on macOS 13.5.2 22G91 darwin-arm64, locale en-TR)
    • Flutter version 3.13.0 on channel stable at /Users/alisinancobani/development/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision efbf63d9c6 (6 weeks ago), 2023-08-15 21:05:06 -0500
    • Engine revision 1ac611c64e
    • Dart version 3.1.0
    • DevTools version 2.25.0

[✓] Xcode - develop for iOS and macOS (Xcode 15.0)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15A240d
    • CocoaPods version 1.12.1

[✓] IntelliJ IDEA Ultimate Edition (version 2023.2.2)
    • IntelliJ at /Users/alisinancobani/Applications/IntelliJ IDEA Ultimate.app
    • Flutter plugin version 75.1.4
    • Dart plugin version 232.9559.10

[✓] Connected device (4 available)
    • Ali Sinan’s iPhone (mobile) • 00008030-000E0C4A3E91802E            • ios            • iOS 17.0.1 21A340
    • iPhone 15 Pro Max (mobile)  • EFA350D8-D6B5-4AE0-8611-B54055363A36 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-17-0 (simulator)
    • macOS (desktop)             • macos                                • darwin-arm64   • macOS 13.5.2 22G91 darwin-arm64
    • Chrome (web)                • chrome                               • web-javascript • Google Chrome 117.0.5938.92

Solution

  • Just have to use the NativeAdapter(); for dio