Hi,
I’ve got a problem that I don’t understand with ionic.
I wrote a small program like that:
import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
import { DeviceOrientation, DeviceOrientationCompassHeading } from '@ionic-native/device-orientation';
@Component({
selector: 'page-home',
templateUrl: 'home.html'
})
export class HomePage {
heading:Number;
constructor(public navCtrl: NavController, private deviceOrientation: DeviceOrientation) {
// this.heading=100;
// setInterval(function(){
// this.heading = this.heading+1;
// }.bind(this), 1000)
this.heading = 100;
// Get the device current compass heading
this.deviceOrientation.getCurrentHeading().then(
(data: DeviceOrientationCompassHeading) => this.heading = data.trueHeading,
(error: any) => console.log(error)
);
// Watch the device compass heading change
var subscription = this.deviceOrientation.watchHeading().subscribe(
(data: DeviceOrientationCompassHeading) => this.heading=data.trueHeading,
);
}
}
This app is working perfectly on Android but ios it gives me a blank page !
Does someone have a solution to this problem ?