ionic 4: Blank screen in simulator when using http-native
See original GitHub issueIonic version: (check one with “x”) (For Ionic 1.x issues, please use https://github.com/ionic-team/ionic-v1) [ ] 2.x [ ] 3.x [x] 4.x
I’m submitting a … (check one with “x”) [x] bug report [ ] feature request
Current behavior: I’m getting a blank screen when I try to use the http-native.
Expected behavior: The App should launch properly
Steps to reproduce:
- Create a new ionic 4 project, ex: tabs
- Follow the steps to add
cordova-plugin-advanced-httpdescribed here: https://ionicframework.com/docs/native/http/ - Launch the app in the simulator:
ionic cordova emulate ios -lc - Result: blank screen
Error in Safari console:
TypeError: Object(_ionic_native_core__WEBPACK_IMPORTED_MODULE_1__["Cordova"]) is not a function. (In 'Object(_ionic_native_core__WEBPACK_IMPORTED_MODULE_1__["Cordova"])({ sync: true })', 'Object(_ionic_native_core__WEBPACK_IMPORTED_MODULE_1__["Cordova"])' is an instance of Object)
Related code:
`` import { Component } from ‘@angular/core’; import { Platform } from ‘@ionic/angular’; import { HTTP } from ‘@ionic-native/http’;
@Component({ selector: ‘app-page-about’, templateUrl: ‘about.page.html’, styleUrls: [‘about.page.scss’] }) export class AboutPage {
constructor( private http: HTTP, private platform: Platform, ) {
console.log('### 1 Vai chamar...');
this.platform.ready().then(() => {
console.log('### 2 chamou!');
this.http.get('http://ionic.io', {}, {})
.then(data => {
console.log('### 3 resultado:');
console.log(data.status);
console.log(data.data); // data received by server
console.log(data.headers);
})
.catch(error => {
console.log('### 4 babou!');
console.log(error.status);
console.log(error.error); // error message as string
console.log(error.headers);
});
});
}
}
Other information:
Ionic info: (run ionic info from a terminal/cmd prompt and paste output below):
li packages: (/usr/local/lib/node_modules)
@ionic/cli-utils : 2.0.0-rc.6
ionic (Ionic CLI) : 4.0.0-rc.6
global packages:
cordova (Cordova CLI) : 8.0.0
local packages:
@angular-devkit/core : 0.6.0
@angular-devkit/schematics : 0.6.0
@angular/cli : 6.0.1
@ionic/schematics-angular : 1.0.0-rc.6
Cordova Platforms : ios 4.5.4
Ionic Framework : @ionic/angular 4.0.0-alpha.7
System:
Android SDK Tools : 25.2.5
ios-deploy : 1.9.2
ios-sim : 6.1.2
NodeJS : v8.11.2
npm : 5.6.0
OS : macOS High Sierra
Xcode : Xcode 9.3.1 Build version 9E501
Environment Variables:
ANDROID_HOME : /usr/local/opt/android-sdk
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:18 (1 by maintainers)

Top Related StackOverflow Question
try using the ngx on all of the imports and make sure you are using beta versions
Did you post the gist? I’m having the same problem.