How to Make HTTP Requests In React Native IOS application?

前端 未结 3 2150
天命终不由人
天命终不由人 2021-02-09 11:42
fetch(\'http://119.9.52.47:3000/api/countries\', {
       method: \'POST\',
       headers: { \'Accept\': \'application/json\',\'Content-Type\': \'application/json\'},
          


        
3条回答
  •  甜味超标
    2021-02-09 12:07

    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.

提交回复
热议问题