I’m developing an Ionic 2 application for ios and testing directly in IPhone 5S with XCode.
In a page typescript file I created the lifecycle functions ionViewDidLoad and ionViewDidLeave.
In both functions I placed a navCtrl.setRoot(OtherPage). When testing with ionic serve, the page automatically redirects to another page on entering. When testing in the real device the setRoot() is not called, on entering nor on leaving page.
I’ve inserted the page redirection and some other “logics” instead of logs in order to detect the triggering of the events, and it seems the events in fact aren’t being called. I may try with console.logs, but it probably won’t be different.
About push: I meant that I tried with both this.navCtrl.setRoot(Map) and this.navCtrl.push(Map)
Are you using lazy loading? @Sujan12’s suggestion of inserting a console.log statement is important. I suspect you will see that it is actually entering, but your navigation logic is not working. (Edit - looks like you posted as I posted about console logs)
I suspect this isn’t a browser/device issue, but rather reliance on undefined behavior. Lifecycle events are probably triggered during navigation transitions, inside which new navigation transitions shouldn’t be initiated. IOW, I wouldn’t be surprised if calling setRoot() (or push()) from within either ionViewDidEnter() or ionViewWillLeave() simply results in unpredictable weirdness.