Flutter iOS Emulator 'Failed Host Lookup' Error

255 views Asked by At

Hello fellow developers

I'm developing a location-sharing application with Flutter. When I launch the iOS emulator, I encounter a 'Failed host lookup' error. This issue is happening for both the map server and the backend server. Strangely, some HTTP requests are successful. I have been investigating for a day but cannot determine the cause. Please help me.

What I've tried

  • Adding Mac DNS configuration to 8.8.8.8
  • Restarting the development machine and emulator
  • Testing with both a fixed-line connection and a mobile data connection
  • Running 'Flutter upgrade'
  • Running 'Flutter doctor'

Example Error Messages

flutter: ClientException with SocketException: Failed host lookup: 'cyberjapandata.gsi.go.jp' (OS Error: nodename nor servname provided, or not known, errno = 8), uri=https://cyberjapandata.gsi.go.jp/xyz/std/16/56527/26252.png?

[VERBOSE-2:dart_vm_initializer.cc(41)] Unhandled Exception: ClientException with SocketException: Failed host lookup: 'xxx.supabase.co' (OS Error: nodename nor servname provided, or not known, errno = 8), uri=https://xxx.supabase.co/rest/v1/yyy
#0      IOClient.send (package:http/src/io_client.dart:119:7)

Screenshot

my app screenshot

1

There are 1 answers

0
Shahed Emon On

Add in info.plist

<key>NSAppTransportSecurity</key>
            <dict>
                <key>NSAllowsArbitraryLoads</key>
                <true/>
                <key>NSAllowsArbitraryLoadsInWebContent</key>
                <true/>
            </dict>