TypeError: Network request failed on iPhone

Hi!

I am doing this fetch:

fetch("http://www.spekterfestival.no/wp-json/wp/v2/pages")
.then(function(result) {
    if (result.status !== 200) {
      debug_log("Something went wrong, status code: " + result.status);
      return;
    }
    return result.json();
  }).then(function(data) {
    debug_log("Success!");

    for (var i = 0; i < 10; i++) {
      var item = data[i];
      dataFromSpekter.add(item);
    }
  }).catch(function(error) {
    debug_log("ErrorMessage: " + error);
});

On the local preview i get the data displayed, but on my iPhone I get:

TypeError: Network request failed

Any idea how to fix this?

Kristoffer

Hi!

Are you sure your iPhone is online? Try entering that URL in the phone’s browser?

Hi!

Yes, I tried the exact URL from above in the Safari browser on the iPhone first, and ther it shows the data as i should.

In case anyone else comes across this: The issue was due to the NSAppTransportSecurity in iOS defaulting to only allowing https.

It was resolved by updating to a more recent version of Fuse which contains a workaround for this.