Network Request Failed。
Google了一下,在stackoverflow上发现其他网友也遇到类似问题:
https://stackoverflow.com/questions/38418998/react-native-fetch-network-request-failed
网友回复说iOS默认不允许HTTP请求,只允许HTTPS。如果想用HTTP,需要在info.plist里加入下面信息:
<key>NSAppTransportSecurity</key> <dict> <key>NSAllowsArbitraryLoads</key> <true/> </dict> <key>NSAppTransportSecurity</key> <dict> <key>NSExceptionDomains</key> <dict> <key>yourserver.com</key> <dict> <!--Include to allow subdomains--> <key>NSIncludesSubdomains</key> <true/> <!--Include to allow HTTP requests--> <key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key> <true/> <!--Include to specify minimum TLS version--> <key>NSTemporaryExceptionMinimumTLSVersion</key> <string>TLSv1.1</string> </dict> </dict> </dict>
详细信息参考React Native的官网: