{"id":5576,"date":"2016-12-02T14:05:35","date_gmt":"2016-12-02T06:05:35","guid":{"rendered":"https:\/\/sdeno.com\/?p=5576"},"modified":"2016-12-02T14:06:09","modified_gmt":"2016-12-02T06:06:09","slug":"%e8%a7%a3%e5%86%b3%ef%bc%9areact-native%e7%94%a8fetch%e5%87%bd%e6%95%b0%e8%af%b7%e6%b1%82%e6%95%b0%e6%8d%ae%e5%a4%b1%e8%b4%a5%e9%97%ae%e9%a2%98network-request-failed","status":"publish","type":"post","link":"https:\/\/sdeno.com\/?p=5576","title":{"rendered":"\u89e3\u51b3\uff1areact native\u7528fetch\u51fd\u6570\u8bf7\u6c42\u6570\u636e\u5931\u8d25\u95ee\u9898Network Request Failed"},"content":{"rendered":"<p>\u5728\u4f7f\u7528react native\u8bf7\u6c42\u6570\u636e\u65f6\uff0c\u5b8c\u5168\u53ef\u4ee5\u4e0d\u7528\u8003\u8651\u8de8\u57df\u7684\u95ee\u9898\u76f4\u63a5\u586b\u5199\u8981\u83b7\u53d6\u7684\u5730\u5740\u5c31\u53ef\u4ee5\u3002<\/p>\n<p>\u4f46\u662f\u5728\u7528react native\u5f00\u53d1\u65f6\u5019\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u662f\u53ea\u80fd\u652f\u6301https\u8bf7\u6c42\u7684\uff0c\u5c31\u662f\u8bf4http\u8bf7\u6c42\u7684\u5730\u5740\u4f1a\u63d0\u793a\u5931\u8d25\uff0cNetwork Request Failed\u3002<\/p>\n<p>\u8fd9\u65f6\u5019\u6211\u4eec\u9700\u8981\u4fee\u6539\u6211\u4eec\u7684\u9879\u76ee\u914d\u7f6e\u6587\u4ef6\uff0c\u6253\u5f00\/ios\/\u9879\u76ee\u540d\/Info.plist\uff0c\u5c06\u539f\u6765\u7684\u5185\u5bb9\uff1a<\/p>\n<pre>&lt;key&gt;NSAppTransportSecurity&lt;\/key&gt;\r\n&lt;dict&gt;\r\n &lt;key&gt;NSExceptionDomains&lt;\/key&gt;\r\n  &lt;dict&gt;\r\n   &lt;key&gt;localhost&lt;\/key&gt;\r\n    &lt;dict&gt;\r\n     &lt;key&gt;NSExceptionAllowsInsecureHTTPLoads&lt;\/key&gt;\r\n     &lt;true\/&gt;\r\n    &lt;\/dict&gt;\r\n  &lt;\/dict&gt;\r\n&lt;\/dict&gt;<\/pre>\n<p>\u4fee\u6539\u4e3a \uff1a<\/p>\n<pre>&lt;key&gt;NSAppTransportSecurity&lt;\/key&gt;\r\n&lt;dict&gt;\r\n   &lt;key&gt;NSAllowsArbitraryLoads&lt;\/key&gt;\r\n   &lt;true\/&gt;\r\n&lt;\/dict&gt;<\/pre>\n<p><a href=\"http:\/\/stackoverflow.com\/questions\/38418998\/react-native-fetch-network-request-failed\" target=\"_blank\">http:\/\/stackoverflow.com\/questions\/38418998\/react-native-fetch-network-request-failed\u00a0<\/a><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u4f7f\u7528react native\u8bf7\u6c42\u6570\u636e\u65f6\uff0c\u5b8c\u5168\u53ef\u4ee5\u4e0d\u7528\u8003\u8651\u8de8\u57df\u7684\u95ee\u9898\u76f4\u63a5\u586b\u5199\u8981\u83b7\u53d6\u7684\u5730\u5740\u5c31\u53ef\u4ee5\u3002 \u4f46\u662f\u5728\u7528re [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[43],"tags":[],"class_list":["post-5576","post","type-post","status-publish","format-standard","hentry","category-react-native"],"_links":{"self":[{"href":"https:\/\/sdeno.com\/index.php?rest_route=\/wp\/v2\/posts\/5576","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sdeno.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sdeno.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sdeno.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sdeno.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5576"}],"version-history":[{"count":0,"href":"https:\/\/sdeno.com\/index.php?rest_route=\/wp\/v2\/posts\/5576\/revisions"}],"wp:attachment":[{"href":"https:\/\/sdeno.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5576"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sdeno.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5576"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sdeno.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5576"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}