02-13-2019 18:00 - edited 02-14-2019 12:12
02-13-2019 18:00 - edited 02-14-2019 12:12
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.
02-22-2019 12:52
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.
02-22-2019 12:52
Have you granted the internet permission to your app? https://dev.fitbit.com/build/guides/permissions/#internet
Are those URL parameters properly escaped?
Best Answer02-22-2019 12:52
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.
02-22-2019 12:52
Have you granted the internet permission to your app? https://dev.fitbit.com/build/guides/permissions/#internet
Are those URL parameters properly escaped?
Best Answer04-01-2019 21:01
04-01-2019 21:01
Hi, Jon. It was actually my mistake... I didn't notice the parameters were not properly escaped. Thanks!
Best Answer