How to Make HTTP Requests In React Native IOS application?

前端 未结 3 1808
栀梦
栀梦 2021-02-09 11:26
fetch(\'http://119.9.52.47:3000/api/countries\', {
       method: \'POST\',
       headers: { \'Accept\': \'application/json\',\'Content-Type\': \'application/json\'},
          


        
3条回答
  •  攒了一身酷
    2021-02-09 11:49

    Quoting Network docs:

    By default, iOS will block any request that's not encrypted using SSL. If you need to fetch from a cleartext URL (one that begins with http) you will first need to add an App Transport Security exception.

    Your request is http, so you need to either add the address as an App Transport Security exception in your ios app, or use https.

提交回复
热议问题