• Jobs
  • About Us
  • professionals
    • Home
    • Jobs
    • Courses and challenges
    • Questions
    • Teachers
  • business
    • Home
    • Post vacancy
    • Our process
    • Pricing
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Salary Calculator

0

136
Views
Axios running on Capacitor recieves the correct response in Catch Block only in IOS

I have wrapped my react app with capacitor 3.0. Using Axios 0.21.4 version. Api calls are working as expected in Web and android. However in IOS, the request reaches the server and server sends the correct response back. The response is being caught in catch block of axios as Network Error which consists of the request data i sent to server.

const apiurl = "https://xxxx.xxx.com/receiptReader";
const upload = async (e) => {
  const frmdata = new FormData();
  frmdata.append("file", document.getElementById("a").files[0]);

  await axios({
    method: "post",
    url: apiurl,
    data: frmdata,
    headers: {
      Authorization: "ccccc@hotmail.com",
      "Content-Type": "multipart/form-data",
    },
  }).then((response) => {
      console.log(response);
      setHi(JSON.stringify(response));
    })
    .catch((error) => {
      console.log(error.message);
      console.log("error");
    });
};

I didnt change any config for ios. Its the same given with capacitor. Any help would be absolutely grateful in this regard.

almost 3 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Our process Sales
Legal
Terms and conditions Privacy policy
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recommend me some offers
I have an error