kris kris - 10 months ago 47
iOS Question

Cordova iOS deviceready never fires

I've been developing Cordova apps for a number of years now, and often I come across the problem where the "deviceready" event simply does not fire in iOS.

(This is not the

file missing, which seems to be the only answer I'm finding on SO).

Currently I'm using Cordova v6.3.1, though I've had this same issue on many earlier versions.

Surely others face this issue - I'm going to try and solve it now and will post the answer here.


<script src="cordova.js"></script>
function() { alert('device ready fired!'); }, false);

Answer Source

This may have been caused by the changes by iOS, making the push plugin I was using stop working.
I've done many things, they may have all helped, I'll list them all:

What seemed to solve it

  1. Remove all plugins and re-add them

cordova plugin ls (see all plugins and make a note of them)
cordova plugin rm plugin-name (for each one)
cordova plugin add plugin-name (add 'em all back in )

What may have also helped

  1. I updated to the latest Xcode

  2. Update cordova (and cordova-ios) to the latest version

sudo npm install -g cordova
cordova platform update ios@latest

  1. Add and remove ios platform

cordova platform rm ios
cordova platform add ios