Ionic native http plugin not working on ios device


#1

Hello,

I 've used the http ionic native plugin in my app. It works fine in ionic cordova run browser, but it fails on my ios device.
here is my script:

import { Component, OnInit } from ‘@angular/core’;
import { IonicPage, NavController, NavParams } from ‘ionic-angular’;
import { HTTP } from ‘@ionic-native/http’;

import procedures from ‘…/…/services/data/procedureTotaal’;

@IonicPage()
@Component({
selector: ‘page-procedure-layout’,
templateUrl: ‘procedure-layout.html’,
})
export class ProcedureLayoutPage implements OnInit{
public Inhoud: any;
public procedurelijst: any;
id: any;
P: any;
materialen: any;
voorbereiding:any;
Materiaal:any;
Uitvoering:any;
NazorgRegistratie:any;
Aandachtspunten:any;

ngOnInit(){

this.procedurelijst = procedures;

}

constructor(public navCtrl: NavController, public navParams: NavParams, private http: HTTP, ) {
}

ionViewDidLoad() {
this.id = this.navParams.get(‘id’);
this.P = this.navParams.get(‘P’);
console.log(‘ionViewDidLoad ProcedureLayoutPage’);
this.materialen = this.navParams.get(‘Materialen’ );
this.voorbereiding = this.navParams.get(‘Voorbereiding’);
this.Materiaal = this.navParams.get(‘Materiaal’);
this.Uitvoering = this.navParams.get(‘Uitvoering’);
this.NazorgRegistratie = this.navParams.get(‘NazorgRegistratie’);
this.Aandachtspunten = this.navParams.get(‘Aandachtspunten’);

this.http.get('assets/procedures/' + this.id + 'M'+'.html', {}, {})
  .then(data => {
    console.log(data.data);
    this.Materiaal = data.data;
  }

);
this.http.get(‘assets/procedures/’ + this.id + ‘V’+’.html’, {}, {})
.then(data => {
console.log(data.data);
this.voorbereiding = data.data;
}
);

this.http.get('assets/procedures/' + this.id + 'U'+'.html', {}, {})
  .then(data => {
    console.log(data.data);
    this.Uitvoering = data.data;
  }
);

this.http.get('assets/procedures/' + this.id + 'NR'+'.html', {}, {})
  .then(data => {
    console.log(data.data);
    this.NazorgRegistratie = data.data;
  }
);

this.http.get('assets/procedures/' + this.id + 'A'+'.html', {}, {})
  .then(data => {
    console.log(data.data);
    this.Aandachtspunten = data.data;
  }
);

}

}

here are the diagnostics of xcode:

2018-06-10 17:43:26.984504+0200 PLOTSO[582:72111] THREAD WARNING: [‘StatusBar’] took ‘98.360107’ ms. Plugin should use a background thread.
2018-06-10 17:43:38.828787+0200 PLOTSO[582:72111] ionViewDidLoad StandingOrders
2018-06-10 17:43:43.184721+0200 PLOTSO[582:72111] ionViewDidLoad Procedures
2018-06-10 17:43:47.307983+0200 PLOTSO[582:72111] ionViewDidLoad ProcedureLayoutPage
2018-06-10 17:43:47.437579+0200 PLOTSO[582:72111] THREAD WARNING: [‘CordovaHttpPlugin’] took ‘109.747070’ ms. Plugin should use a background thread.
2018-06-10 17:43:47.456500+0200 PLOTSO[582:72375] CFNetwork Diagnostics [1:5] 17:43:47.453 {
LoaderWhatToDo: (null)
Request: <CFURL 0x108c07340 [0x1b7908538]>{string = assets/procedures/P1M.html, encoding = 134217984, base = (null)}
CachePolicy: 0
WhatToDo: originload
CreateToNow: 0.00743s
} [1:5]
2018-06-10 17:43:47.457594+0200 PLOTSO[582:72410] CFNetwork Diagnostics [1:6] 17:43:47.453 {
LoaderWhatToDo: (null)
Request: <CFURL 0x107404b70 [0x1b7908538]>{string = assets/procedures/P1A.html, encoding = 134217984, base = (null)}
CachePolicy: 0
WhatToDo: originload
CreateToNow: 0.00747s
} [1:6]
2018-06-10 17:43:47.457969+0200 PLOTSO[582:72285] CFNetwork Diagnostics [1:7] 17:43:47.453 {
LoaderWhatToDo: (null)
Request: <CFURL 0x1014f7360 [0x1b7908538]>{string = assets/procedures/P1V.html, encoding = 134217984, base = (null)}
CachePolicy: 0
WhatToDo: originload
CreateToNow: 0.00757s
} [1:7]
2018-06-10 17:43:47.458140+0200 PLOTSO[582:72409] CFNetwork Diagnostics [1:3] 17:43:47.453 {
LoaderWhatToDo: (null)
Request: <CFURL 0x107402c80 [0x1b7908538]>{string = assets/procedures/P1NR.html, encoding = 134217984, base = (null)}
CachePolicy: 0
WhatToDo: originload
CreateToNow: 0.00722s
} [1:3]
2018-06-10 17:43:47.458170+0200 PLOTSO[582:72342] CFNetwork Diagnostics [1:4] 17:43:47.453 {
LoaderWhatToDo: (null)
Request: <CFURL 0x1014f7830 [0x1b7908538]>{string = assets/procedures/P1U.html, encoding = 134217984, base = (null)}
CachePolicy: 0
WhatToDo: originload
CreateToNow: 0.00741s
} [1:4]
2018-06-10 17:43:47.470861+0200 PLOTSO[582:72285] Task <70F4B8BE-9C40-4A32-A370-54BF1D478A77>.<1> finished with error - code: -1002
2018-06-10 17:43:47.471063+0200 PLOTSO[582:72375] Task <342DBC20-1C44-4FA1-8DF4-09526A7DC8FF>.<1> finished with error - code: -1002
2018-06-10 17:43:47.471111+0200 PLOTSO[582:72342] Task .<1> finished with error - code: -1002
2018-06-10 17:43:47.471161+0200 PLOTSO[582:72409] Task <7A2BC6F8-D97F-4F5A-ADA3-4ECF0C2FBC1F>.<1> finished with error - code: -1002
2018-06-10 17:43:47.471205+0200 PLOTSO[582:72410] Task <5681E3B4-962F-4E75-BC4A-FD598DA950BA>.<1> finished with error - code: -1002
2018-06-10 17:44:00.198975+0200 PLOTSO[582:72111] Status bar could not find cached time string image. Rendering in-process.
2018-06-10 17:51:00.004618+0200 PLOTSO[582:72111] Status bar could not find cached time string image. Rendering in-process.
2018-06-10 17:52:00.002763+0200 PLOTSO[582:72111] Status bar could not find cached time string image. Rendering in-process.
2018-06-10 17:53:00.002393+0200 PLOTSO[582:72111] Status bar could not find cached time string image. Rendering in-process.
2018-06-10 17:54:00.001977+0200 PLOTSO[582:72111] Status bar could not find cached time string image. Rendering in-process.
2018-06-10 17:55:00.001252+0200 PLOTSO[582:72111] Status bar could not find cached time string image. Rendering in-process.
2018-06-10 17:56:00.002396+0200 PLOTSO[582:72111] Status bar could not find cached time string image. Rendering in-process.
2018-06-10 17:57:00.001951+0200 PLOTSO[582:72111] Status bar could not find cached time string image. Rendering in-process.
2018-06-10 17:58:00.002135+0200 PLOTSO[582:72111] Status bar could not find cached time string image. Rendering in-process.
2018-06-10 17:59:00.001249+0200 PLOTSO[582:72111] Status bar could not find cached time string image. Rendering in-process.
2018-06-10 18:00:00.003165+0200 PLOTSO[582:72111] Status bar could not find cached time string image. Rendering in-process.
2018-06-10 18:01:00.003143+0200 PLOTSO[582:72111] Status bar could not find cached time string image. Rendering in-process.