Http.post not working in ios ionic 2

I'm working on ionic 2. This code works fine in android device, but in iOS device api doesn't work and can't see any errors in Xcode console. I tried NSExceptionAllowsInsecureHTTPLoads but it doesn't work.

sendMsg(data)
  {
    this.headers = new Headers();
    this.headers.append('Content-Type','application/json');  
    let body=data;
    return this.http.post
       ('https://www.example.com/api/',JSON.stringify(body),
         {headers:this.headers})
    .map(res => res.json());
  }

      

+3


source to share





All Articles