Estoy teniendo problemas con PhoneGap en el iPhone con los eventos. La aplicación funciona bastante bien en mi dispositivo Android, pero en mi iPhone no funciona. Por ejemplo, un código simple como esto:Eventos de Phonegap que no funcionan en iphone
<!DOCTYPE HTML>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0;" />
<meta charset="utf-8">
<title>WayAcross Mobile Application</title>
<link rel="stylesheet" href="css/jquery.css" />
<link rel="stylesheet" href="css/screen.css" />
<link rel="stylesheet" href="css/login.css" />
<script type="text/javascript" charset="utf-8" src="jquery/jquery.js"></script>
<script type="text/javascript" charset="utf-8" src="jquery/jquery.mobile.js"></script>
<script type="text/javascript" charset="UTF-8" src="javascript/mainJavascript.js"></script>
<script type="text/javascript" charset="utf-8">
// Call onDeviceReady when PhoneGap is loaded.
//
// At this point, the document has loaded but phonegap.js has not.
// When PhoneGap is loaded and talking with the native device,
// it will call the event `deviceready`.
//
function onLoad(){
document.addEventListener("deviceready", onDeviceReady, false);
}
// PhoneGap is loaded and it is now safe to make calls PhoneGap methods
//
function onDeviceReady() {
// Now safe to use the PhoneGap API
alert('ready');
}
</script>
<script type="text/javascript" charset="utf-8" src="javascript/phonegap.js"></script>
</head>
<body onload="onLoad()">
(este es un ejemplo de código que no funciona con el iPhone y funciona con Android).
Creo que es un problema con los eventos, pero no estoy seguro. Incluso los ejemplos de código en documentos de PhoneGap no funcionan. Mi entorno es:
- Mac OS X 10.7.1
- Xcode 4.1
- PhoneGap 1.1
- jQuery Mobile 1.0RC La única cosa que me muestra es la siguiente: http://cl.ly/0h462Y2D2F0J0B1B0q1M
Gracias de antemano.
Saludos,
Elkas
Por cierto, he instalado OS X Lion 10.7.2 y Xcode 4.2 ahora. Incluso en el IOS5 no funciona. ¡¡¡Esto me está volviendo loca!!! Incluso con este código simple no está funcionando.
<!DOCTYPE html>
<html>
<head>
<title>PhoneGap Device Ready Example</title>
<script type="text/javascript" charset="utf-8">
// Call onDeviceReady when PhoneGap is loaded.
//
// At this point, the document has loaded but phonegap.js has not.
// When PhoneGap is loaded and talking with the native device,
// it will call the event `deviceready`.
//
document.addEventListener("deviceready", onDeviceReady, false);
// PhoneGap is loaded and it is now safe to make calls PhoneGap methods
//
function onDeviceReady() {
alert('Hello World');
}
</script>
<script type="text/javascript" charset="utf-8" src="javascript/phonegap.js"</script>
</head>
<body>
</body>
</html>
Todo se ve bien allí, intente registrar cosas usando alert() para averiguar dónde está fallando. – sciritai
También intenta eso. si puse onload = "onDeviceReady()" en la etiqueta del cuerpo u otra función, muestra la alerta, pero los "eventos" phonegap todavía no funcionan. = ( – Elkas
jQuery mobile debe agregarse * después de * scripts personalizados. – Walf