Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PhoneGap onDeviceReady won't fire up on iPhone

Tags:

cordova

I've got a PhoneGap app that won't run the "deviceready" event on an iPhone but WILL run it on Android.

Any ideas why is this? or how to fix it?

(PhoneGap ver 1.0)

The code is :

function onBodyLoad()
{
     if (typeof navigator.device == "undefined"){
          document.addEventListener("deviceready", onDeviceReady, false);
     } else {
         onDeviceReady();
     }
}

<body onload="onBodyLoad()">

Thanks!

like image 713
Roman Avatar asked Aug 21 '11 09:08

Roman


1 Answers

Did you just copy your www folder from one to the other? Android and iOS use their own phonegap-1.0.0.js file. Make sure you are using the correct js file for the platform.

like image 54
Devgeeks Avatar answered Sep 24 '22 16:09

Devgeeks