3

I can't seem to find a simple example of correctly using CORS in conjunction with WKWebview for Ionic 2 on iOS.

Here's the code I'm using, which was previously working on UIWebview:

let headers = new Headers();
headers.append('Content-Type', "application/json");  

var url = "https://myawssigningurlexample.com/1234";
var params = JSON.stringify({
  someObj: 'blah'
});

return this._http.post(url, params, { headers: headers })
  .map(res => res.json())
  .catch((error: any) => {
    return Observable.throw(error);
  });

The doc here doesn't actually provide an example, but says you need to do it: http://ionicframework.com/docs/wkwebview/#cors

Q) Please can someone provide a simple example of how to do it?

Dave
  • 5,283
  • 7
  • 44
  • 66
  • According to the docs, we're supposed to add http://ionicframework.com/docs/native/http/ and use that, but I can't even get that to load in my app.module.ts – ganey Nov 02 '17 at 17:19

0 Answers0