title: Not Able to do API Calls in ReactNative App
body: <p>I am building a ReactNative based App by learning from Internet.</p>
  
  <p>I am now just trying to do simple API Call inside the app.</p>
  
  <p>The same API is working in other projects, but for me its not.</p>
  
  <p>I am not able to figure it out whether Its ReactNative Issue or API Issue. As per me it can not be API Issue.</p>
  
  <p>My App has --</p>
  
  <pre><code>"react": "16.0.0-alpha.6",
  "react-native": "0.44.0",
  </code></pre>
  
  <p>I am running app via <code>react-native run-ios</code> command.</p>
  
  <p>Based on my searching of the issue, I have already tried these things - but still not success.</p>
  
  <ol>
  <li>Adding All <code>AppTransportSecurity</code> things inside <code>info.plist</code>.</li>
  <li>Deleting and installing again all Node Modules.</li>
  <li>Tried by running the same on Android, still same.</li>
  </ol>
  
  <p>My Code for API Call -</p>
  
  <pre><code>fetch(api.login(this.state.email,this.state.password), {
                  method: "POST",
                      headers: {
                          'Accept': 'application/json',
                          'Content-Type': 'application/json',
                          //'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
                      },
                      body: JSON.stringify({
                          'email': this.state.email,
                          'password': this.state.password
                      })
                  })
                  .then((response) =&gt; response.json())
                  .then((responseData) =&gt; {
  
                      if(responseData.status===200){
  
                          if(Platform.OS==="ios"){
                              Alert.alert( 'Success',"", { cancelable: false });
                          }else{
                              ToastAndroid.show('Success', ToastAndroid.SHORT);
                          }
  
                          //storageHelper.saveUser(responseData.data.user_id.toString());
                          //this.fetchUserProfile();
                      }else{
                          if(Platform.OS==="ios"){
                              Alert.alert( 'Please try again',"", { cancelable: false });
                          }else{
                              ToastAndroid.show('Please try again', ToastAndroid.SHORT);
                          }
                      }
                  })
                  .catch(e =&gt; {
  
                      if(Platform.OS==="ios"){
                          Alert.alert('error','Login fail'+JSON.stringify(e), { cancelable: false });
                      }else{
                          ToastAndroid.show('Error : Login fail'+JSON.stringify(e), ToastAndroid.SHORT);
                      }
                  })
                  .done();
  </code></pre>
  
  <p>And I am getting this error from <code>catch</code> condition -</p>
  
  <pre><code>Login fail{"line":15259, "column":29,"sourceURL":"http://localhost:8081/index.ios.bundle?platform=ios&amp;dev=true&amp;minify=false"}
  </code></pre>
  
  <p>I am stuck on the Issue, Need a solution.</p>
  
  <p>Thanks,</p>