Hey all,
I’m getting an error whilst serving and building my application. It is as follows
Module "ionic-native" has no exported member 'CompassHeading'
This is a common error whenever dealing with pages or providers but not generally with modules. Ironically it still works as expected with serve but not with build of either ios or android. And I did start a blank ionic -v2 project and just added these two to make sure that none of my other code is messing up. i think native is legitimately missing aspects of the compass control via cordova.
Full code as follows: and yes, I understand it’s not best practice to use the constructor for heavy lifting, merely for quick testing.
import { Component } from '@angular/core';
import { DeviceOrientation, CompassHeading } from 'ionic-native';
import { NavController } from 'ionic-angular';
@Component({
selector: 'page-home',
templateUrl: 'home.html'
})
export class HomePage {
testing: any;
constructor(public navCtrl: NavController) {
DeviceOrientation.getCurrentHeading().then(
(data: CompassHeading) => {
console.log(data)
},
(error: any) => console.log(error)
)
this.testing = DeviceOrientation.watchHeading().subscribe((data: CompassHeading) => {
console.log(data)
}
)
}
}
ion-info as follows
Cordova CLI: 6.5.0
Ionic Framework Version: 2.0.1
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
Ionic App Scripts Version: 1.1.0
ios-deploy version: 1.9.0
ios-sim version: 5.0.9
OS: macOS Sierra
Node Version: v7.2.0
Xcode version: Xcode 8.2.1 Build version 8C1002
Any help would be greatly appreciated! I need to get out there and start testing my app outside of ion-upload soon!