$ionicPlatform.ready not firing on device (iOS)

There are a couple of posts that highlight this issue already, however they’re quite old and don’t have any solution.

Apparently the issue only happens with iOS 9+, but I can’t verify that.

It’s strange because the $ionicPlatform.ready that sits in the intial .run() works absolutely fine, however if I try it from within a controller, it doesn’t fire. It does in the browser though…

I’m injecting $ionicPlatform into my controller. I’ve tried using the Cordova way using ‘deviceready’, but that isn’t firing either, but again - it fires fine in the browser.

iOS 9 has been out for a while and Ionic has been updated since, so surely there must be a way around this?!

Basically, my app needs to know the device is ready, so any workarounds would help.

Thanks!

I use the platformReady trigger inside the .run as you mention and that works fine, haven’t tried inside another controller (I am on iOS 9.x). However, if it works inside .run and doesn’t work inside other controllers due to some bug, you could possibly broadcast or emit your own event from within .run’s platformReady?

Well… I sort of just tried that now and realised there’s another issue.

For this, I included the $rootScope and tried $rootScope.DeviceReady = true;.

Then from within my controller, I injected $rootScope and tried alert($rootScope.DeviceReady) expecting it to give me a true. Instead, it gave me undefined.

I tried in the browser and it worked as expected. There’s something odd happening and I’m not sure what’s causing it.

I have the same issue, and even get it with a new blank project, so it’s not my code. It might be my environment.

Unlike you, I can’t even get the $ionicPlatform.ready() in .run to fire.

Hi Steve,

I never figure out the cause of the issue, but I managed to get it working. I deleted the old project and started a new one. I was using the starter sidemenu but this time I used the starter tabs one. I’m not sure if it’s how I configured it, or if there was a bug in the code, but the tabs starter seems to work fine for me.

Hurrah! I started a tabs project like you, and added the console plugin to see if I was getting there. Nothing. So I checked the plugins and realised that the keyboard plugin that was being called wasn’t installed with the tabs project. After I did that rebuilt and then tried it all worked.

I went back to my original, readded the plugins and then “ionic build ios” before loading into Xcode and running fomr there - and it works!

At least I can continue for now :slight_smile:

Just to narrow this down further as there are a couple of things that lead to this:

  1. When you start a new project from the CLI it doesn’t add the plugins to the IOS project, so start with “ionic plugin list” and then "ionic plugin remove "

  2. Reinstall the plugins you want including console, BUT use “com.ionic.keyboard” for the keyboard, NOT the cordova plugin.

Should work then

Steve

Hi!

Are you sure that you are debugging the plugins load, etc…?

I had that problem and it was the tag. Finally I could compile normally without this meta tag.

greetings

Maybe this is old, but for me the reason was that the first call of $ionicPlatform.ready had a crash, because we changed from one keyboard plugin to another, and api’s changed. Hence, there was a crash. After fixing the method calls, everything worked perfectly.