Uncaught TypeError: Object #<Object> hat keine Methode 'exec' an file:///android_asset/www/index.html
- mit PhoenGap 2.2.0
- Ausgeführt \bin\erstellen C:\Temp\Test com.test
- Hatte folgenden Ausgang
Microsoft (R) Windows Script Host Version 5.8
Copyright (C) Microsoft Corporation. Alle Rechte vorbehalten.
Creating new android project...
Building jar and js files...
Copying template files...
Copying js, jar & config.xml files...
Copying cordova command tools...
Updating AndroidManifest.xml and Main Activity...
- Importierte Projekt
-
- Auf eclipse (4.2.0) hat
-
- Datei > Neu > Projekte > Android > Android-Projekt aus vorhandenem Code
-
- Ausgewählten Ordner C:\Temp\Test
-
- Geprüft "Copy project into workspace"
- Änderungen
-
- Geprüft res\xml\config.xml und die Linie
<plugin name="Notification" value="org.apache.cordova.Notification"/>
vorhanden ist
- Geprüft res\xml\config.xml und die Linie
-
- Überprüft, dass index.html hat die cordova-2.2.0.js enthalten
-
- Fall#1 Geöffnet index.html und modifiziert aus
<script type="text/javascript">
app.initialize();
</script>
zu
<script type="text/javascript">
function showAlert(msg){
navigator.notification.alert(msg);
}
document.addEventListener("deviceready", showAlert('You are the winner!'), false);
app.initialize();
</script>
Bekomme ich folgenden Fehler
11-25 10:29:58.399: E/Web Console(14604): Uncaught TypeError: Cannot call method 'alert' of undefined at file:///android_asset/www/index.html:40
-
- Fall#2 Geöffnet index.html und modifiziert aus
<script type="text/javascript">
app.initialize();
</script>
zu
<script type="text/javascript">
function successAlert(){}
function errorAlert(){}
function showAlert(msg){
cordova.exec(successAlert, errorAlert, "Notification","alert", [msg]);
}
document.addEventListener("deviceready", showAlert('You are the winner!'), false);
app.initialize();
</script>
Bekomme ich folgenden Fehler
11-25 10:25:06.575: E/Web Console(14149): Uncaught TypeError: Object #<Object> has no method 'exec' at file:///android_asset/www/index.html:42
}
Ich bin mir sicher, dass ich etwas verpasst...nur, dass ich nicht abschließen können, was es ist. Bitte helfen Sie mir.
Ich habe den Fehler --Uncaught TypeError: Object #<Object> hat keine Methode 'exec' - auch und finde keine Lösung. Ich "cordova-2.2.0.js" in mein "index.html" und rufe "nfc.addNdefListener(callback, [Erfolg], [Fehler]);" umgesetzt "phonegap-nfc.js". Dort ist die "cordova.exec();" Methode genannt. Ich bin mit cordova 2.2.0 und der phonegap-nfc-plugin github.com/chariotsolutions/phonegap-nfc. Aber es ist nirgendwo zu arbeiten, auch wenn ich mich dem Aufruf der exec-Methode direkt in index.html.
InformationsquelleAutor javadevg | 2012-11-25
Du musst angemeldet sein, um einen Kommentar abzugeben.
Diese rufen
showAlert
sofort anstelle von Verzögerung auf, wenn das Ereignis ausgelöst:Sondern tun dies
Danke!!! Es gut funktioniert.
InformationsquelleAutor AndiDog