Dar*_*rye 3 ios phonegap-plugins cordova
好吧,我一直在研究这个问题已经有一段时间了,无法解决这个问题.简单的PhoneGap测试应用程序,试图显示警报.
使用Cordova 2.9.0 for iOS.我添加了一些简单的测试代码并在chrome中测试它以查看它在哪里中断,因为它在模拟器中不起作用
当我在Chrome中测试时(当然模拟器中的结果相同,但没有显示错误消息)
它应该正确引用cordova.js,这是我的app文件夹的结构:
这是我的config.xml代码:
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.blahblahblah.hello" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>Hello World</name>
<description>
Test blahblahblah Application
</description>
<author email="blahblahblah@blahblahblah.com" href="http://blahblahblah.com">
blahblahblah
</author>
<access origin="*" />
<preference name="fullscreen" value="true" />
<preference name="webviewbounce" value="true" />
<plugins>
<plugin name="Notification" value="CDVNotification" />
</plugins>
</widget>
Run Code Online (Sandbox Code Playgroud)
这是我的index.html代码:
<!DOCTYPE html>
<html>
<head>
<title>Notification Example</title>
<script type="text/javascript" charset="utf-8" src="cordova.js"></script>
<script type="text/javascript" charset="utf-8">
// Wait for Cordova to load
//
document.addEventListener("deviceready", onDeviceReady, false);
// Cordova is ready
//
function onDeviceReady() {
// Empty
document.getElementById('tb1').value = 'device ready';
}
// alert dialog dismissed
function alertDismissed() {
// do something
}
// Show a custom alert
//
function showAlert() {
document.getElementById('tb2').value = 'before alert';
navigator.notification.alert(
'You are the winner!', // message
alertDismissed, // callback
'Game Over', // title
'Done' // buttonName
);
document.getElementById('tb3').value = 'after alert';
}
</script>
</head>
<body>
<p><a href="#" onclick="showAlert(); return false;">Show Alert</a></p>
<input type="text" id="tb1" value="" />
<input type="text" id="tb2" value="" />
<input type="text" id="tb3" value="" />
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
我搜索过文档,并没有发现为什么这不起作用的任何线索,这个问题的大部分答案都没有解决版本2.9.0
提前致谢.
And*_*dre 10
我知道问题是关于Phonegap 2.9,但这是当有人寻找"手机屏幕警报无法正常工作"时谷歌吐出的第一件事.所以这就是我使用Phonegap 3.0所做的事情:
根据手册,您需要将插件添加到项目中.只需导航到项目根文件夹并编写以下命令:
$ phonegap local plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs.git
之后,我将其添加到我的html中:
<script type="text/javascript" charset="utf-8" src="phonegap.js"></script>
<script>
document.addEventListener("deviceready", onDeviceReady, true);
function onDeviceReady() {
navigator.notification.alert("PhoneGap is working", function(){}, "", "");
}
</script>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
16499 次 |
| 最近记录: |