Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Unable to execute fetch on iOS phones.

ANSWERED

Hello guys, hope you can help me. I made an app that sends an http request using 'fetch', which works perfectly on Android phones. The problem is that when I try to execute the 'fetch' command on iPhones, it will just not work. I keep on getting the following error: "Failed to execute 'fetch': the value provided as parameter 1 is not a URL". Any thoughts on what might be the problem? This is basically the piece of code that works/doesn't work:

 

fetch('https://myURL?p1=' + v1 + '&p2=' + v2)
.then(function(res) {
    return res.text();
})
.then(function(data) {
   console.log("All good");
})
.catch(err => console.log('[FETCH]: ' + err));

 

 

Thanks in advance.

 

Rolo
Best Answer
1 BEST ANSWER

Accepted Solutions

Have you granted the internet permission to your app? https://dev.fitbit.com/build/guides/permissions/#internet

 

Are those URL parameters properly escaped?

View best answer in original post

Best Answer
0 Votes
2 REPLIES 2

Have you granted the internet permission to your app? https://dev.fitbit.com/build/guides/permissions/#internet

 

Are those URL parameters properly escaped?

Best Answer
0 Votes

Hi, Jon. It was actually my mistake... I didn't notice the parameters were not properly escaped. Thanks!

Rolo
Best Answer
0 Votes