Firstly, if you’ve encountered this problem before you may be thinking, add NSAppTransportSecurity
, already done that, added in config.xml
and even created a hook in after_prepare
for it as follows:
#!/bin/bash
PLIST=platforms/ios/*/*-Info.plist
cat << EOF |
Add :NSAppTransportSecurity dict
Add :NSAppTransportSecurity:NSAllowsArbitraryLoads bool YES
EOF
while read line
do
/usr/libexec/PlistBuddy -c "$line" $PLIST
done
true
It’s failing with this error:
{"_body":{"position":0,"totalSize":0},"status":0,"ok":false,"statusText":"","headers":{},"type":3,"url":null}
This is the code, same exact code works on Android and Web:
let path = "https://us11.api.mailchimp.com/3.0/lists/xxx";
let body = {"members": [{"email_address": email, "status": "subscribed"}], "update_existing": true};
let headers = new Headers ({
'Authorization': 'Basic T2xhOmNlN3R4N2I4MjQyMDg6UmU0MWQ0NDNiNjk2NTg1MjJjYHSzMTE='
});
let options = new RequestOptions({headers: headers});
this.http.post(path, body, options)
.map(res => res.json()).subscribe(data => {
console.log(data);
},
err => {
console.log(err);
})
What could I be doing wrong please?
System:
cli packages: (/usr/local/lib/node_modules)
@ionic/cli-utils : 1.9.2
ionic (Ionic CLI) : 3.9.2
global packages:
Cordova CLI : 7.0.1
local packages:
@ionic/app-scripts : 3.0.0
Cordova Platforms : android 6.2.3 ios 4.4.0
Ionic Framework : ionic-angular 3.7.1
System:
ios-sim : 5.0.8
Node : v6.10.2
npm : 3.10.10
OS : macOS Sierra
Xcode : Xcode 8.3.3 Build version 8E3004b