Ionic 3 consume api after build

Asked

Viewed 48 times

0

Next I have an api running already, and I can make the requests quietly by Ionic serves using the Chrome extension allow access-control-allow-origin , and I have all the right answers , but when I built in my project by xcode , and tried to fulfill the requisitions by xcode/ emulador , with app installed, it didn’t work someone can help me what I can do ? to fix this? type I must declare on xml something?

my xml

<content src="index.html" />
<access origin="*" />

my webservice with the requisition

login(conta: ContaInterface)
{ 
return this.http.post(this.url+'api/userLogin',{
"email": conta.email,
"password": conta.password},{"headers": {'Accept':'application/json'}}); 
}
  • Try debugging by Xcode to see the error that is rolling

1 answer

0

I believe you have to release CORS in your API (in the backend).

If it is done in php you will do something like

 <?php
 header("Access-Control-Allow-Origin: *");

Look for how to release CORS in the programming language you wrote the API.

I hope I’ve helped.

  • @hugocls until his reply helped me, it might be some problem in my Cors in my api , but thank you

Browser other questions tagged

You are not signed in. Login or sign up in order to post.