[ 
https://issues.apache.org/jira/browse/CB-6436?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Shazron Abdullah resolved CB-6436.
----------------------------------

    Resolution: Duplicate

Going to dupe this to CB-5488, discussion should be continued there.

> deviceready not firing on iOS 7.1 with Sencha Touch 2.3.1
> ---------------------------------------------------------
>
>                 Key: CB-6436
>                 URL: https://issues.apache.org/jira/browse/CB-6436
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: CordovaJS
>    Affects Versions: 3.4.0
>         Environment: iOS 7.1
> iPhone 4 + Simulator
>            Reporter: Garth Gutenberg
>
> The {{deviceready}} event never fires due to a JS error on iOS 7.1 with 
> Cordova 3.4.x.  This is the same issue as reported in CB-5488.
> The console error/trace is:
> {quote}
> [Error] TypeError: 'null' is not an object (evaluating 
> 'document.body.appendChild')
> createExecIframe (cordova.js, line 833)
> iOSExec (cordova.js, line 1009)
> getInfo (device.js, line 74)
> (anonymous function) (device.js, line 48)
> fire (cordova.js, line 750)
> (anonymous function) (cordova.js, line 1195)
> f (cordova.js, line 622)
> fire (cordova.js, line 750)
> (anonymous function) (cordova.js, line 1183)
> onScriptLoadingComplete (cordova.js, line 1369)
> scriptLoadedCallback (cordova.js, line 1386)
> {quote}
> The fix that I've applied to cordova.js (from 3.4.1-0.1.0) is to replace 
> lines 1627-1630.
> Old:
> {code:JavaScript}
> window.cordova = require('cordova');
> // file: src/scripts/bootstrap.js
> require('cordova/init');
> {code}
> New:
> {code:JavaScript}
> var documentBodyIntervalID = window.setInterval( function() {
>     if ( null == document.body ) {
>         return;
>     }
>     
>     window.clearInterval( documentBodyIntervalID );
>     window.cordova = require('cordova');
>     // file: src/scripts/bootstrap.js
>     require('cordova/init');
> }, 100 );
> {code}
> I'm just checking document.body every 100ms to make sure that it's not null 
> before triggering the rest of the Cordova script.  I suspect it may have to 
> do with Sencha Touch 2.3.1, but I can't guarantee it.  I can provide an Xcode 
> project if needed.
> **Update**:  I just realized that my fix is wreaking havoc on some plugins, 
> as they load synchronously and expect cordova to be ready as soon as they 
> load, which it isn't.  Definitely need help on this one.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to