I’m developing a React Native application and encountering an issue when making a POST request on iOS. The error message I receive is:
error processing request body error domain=nsurlerror -1000
Heres the error
I use react native 0.73.7. And my API url is correct.
Here is my code:
const onClickPost = async () => {
setApiCall(true);
let data = {
price: price,
registrationPrice: registrationPrice,
brand: make,
postType: 'SELL',
modelYear: year,
carType: bodyType,
mileAge: mileage,
fuel: fuel,
}
const formData = new FormData();
formData.append('model', JSON.stringify(data));
imageUri.forEach((uri, index) => {
formData.append('file', {
uri: uri,
name: `photo_${index}.jpg`,
type: 'image/jpeg',
});
});
console.log("im here");
createOffer(formData).then(() => {
setApiCall(false);
createSuccessAlert();
}).catch(e => {
setApiCall(false);
createFailAlert()
console.log('error');
console.log(e);
throw e;
});
console.log("im here as well");
}