I have installed native HTTP following the instructions from ionic native page but when testing in iOS simulator I got a message that the plugin is not installed.
[Warning] Native: tried calling HTTP.get, but the HTTP plugin is not installed. (vendor.js, line 57914)
[Warning] Install the HTTP plugin: ‘ionic cordova plugin add cordova-plugin-advanced-http’ (vendor.js, line 57920)
I have started a blank project and installed the ionic native http plugin.
Does anyone have a clue?
Thanks,
Luiz
app.module:
import { BrowserModule } from '@angular/platform-browser';
import { ErrorHandler, NgModule } from '@angular/core';
import { IonicApp, IonicErrorHandler, IonicModule } from 'ionic-angular';
import { SplashScreen } from '@ionic-native/splash-screen';
import { StatusBar } from '@ionic-native/status-bar';
import { MyApp } from './app.component';
import { HomePage } from '../pages/home/home';
import { HTTP } from '@ionic-native/http';
@NgModule({
declarations: [
MyApp,
HomePage
],
imports: [
BrowserModule,
IonicModule.forRoot(MyApp)
],
bootstrap: [IonicApp],
entryComponents: [
MyApp,
HomePage
],
providers: [
StatusBar,
SplashScreen,
{provide: ErrorHandler, useClass: IonicErrorHandler},
HTTP
]
})
export class AppModule {}
home.ts
import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
import { HTTP } from '@ionic-native/http';
import 'rxjs/add/operator/map';
@Component({
selector: 'page-home',
templateUrl: 'home.html'
})
export class HomePage {
public teste = [];
constructor(public navCtrl: NavController, private http: HTTP) {
}
ionViewDidLoad() {
return new Promise(resolve => {
this.http.get(URL, {}, {})
.then((response) => {
this.teste = JSON.parse(response.data);
resolve(this.teste)
console.log(this.teste);
}).catch(error => {
console.error(error);
})
});
}
}
Plugins installed:
cordova-plugin-advanced-http 1.7.1 "Advanced HTTP plugin"
cordova-plugin-compat 1.2.0 "Compat"
cordova-plugin-device 1.1.4 "Device"
cordova-plugin-file 4.3.3 "File"
cordova-plugin-ionic-webview 1.1.16 "cordova-plugin-ionic-webview"
cordova-plugin-splashscreen 4.0.3 "Splashscreen"
cordova-plugin-whitelist 1.3.1 "Whitelist"
ionic-plugin-keyboard 2.2.1 "Keyboard"
Ionic info
cli packages: (/usr/local/lib/node_modules)
@ionic/cli-utils : 1.12.0
ionic (Ionic CLI) : 3.12.0
global packages:
cordova (Cordova CLI) : 7.0.1
local packages:
@ionic/app-scripts : 3.0.1
Cordova Platforms : ios 4.4.0
Ionic Framework : ionic-angular 3.8.0
System:
Android SDK Tools : 26.0.2
ios-sim : 6.0.0
Node : v8.1.3
npm : 5.3.0
OS : macOS Sierra
Xcode : Xcode 8.3.3 Build version 8E3004b
Misc:
backend : pro