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.
Answered! Go to the Best Answer.
Fitbit Developers oversee the SDK and API forums. We're here to answer questions about Fitbit developer tools, assist with projects, and make sure your voice is heard by the development team.
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
Fitbit Developers oversee the SDK and API forums. We're here to answer questions about Fitbit developer tools, assist with projects, and make sure your voice is heard by the development team.
Have you granted the internet permission to your app? https://dev.fitbit.com/build/guides/permissions/#internet
Are those URL parameters properly escaped?
Best AnswerHi, Jon. It was actually my mistake... I didn't notice the parameters were not properly escaped. Thanks!
Best Answer