Vojtech B
Vojtech B

Reputation: 2957

Phonegap iOS device.uuid is undefined

I have the following code:

<script type="text/javascript" src="cordova-2.1.0.js"></script>
<script type="text/javascript" charset="utf-8">
// Wait for PhoneGap to load
//
document.addEventListener("deviceready", onDeviceReady, false);

// PhoneGap is ready
//
function onDeviceReady() {
    var element = document.getElementById('deviceProperties');
    element.innerHTML = 'Device Name: '     + device.name     + '<br />' + 
                       'Device PhoneGap: ' + device.phonegap + '<br />' + 
                        'Device Platform: ' + device.platform + '<br />' + 
                        'Device UUID: '     + device.uuid     + '<br />' + 
                       'Device Version: '  + device.version  + '<br />';
}
</script>
</head>
<body>
 <p id="deviceProperties">Loading device properties...</p>
</body>

but my iPhone 4S shows only the "Loading device properties..." text.

Is it another issue with the Corova.plist? I am developing it on windows and I cannot set it in visual editor and I could not find any documentation for its format and possibilities.

Upvotes: 1

Views: 1805

Answers (2)

Krunoslav Djakovic
Krunoslav Djakovic

Reputation: 171

Try removing "device" from ids in html.

Upvotes: 0

Nick Roth
Nick Roth

Reputation: 3077

Have a look at the sample ondeviceready handler in the documentation

http://docs.phonegap.com/en/2.2.0/cordova_events_events.md.html#deviceready

They use

function onLoad() {
    document.addEventListener("deviceready", onDeviceReady, false);
}

with

<body onload="onLoad()">

Try setting up your event handler in a similar manner.

Upvotes: 2

Related Questions