简体   繁体   English

如何获取警报通知以与Phonegap 1.1.0和iOS5一起使用

[英]How to get alert notifications to function with Phonegap 1.1.0 and iOS5

I am upgrading a Phonegap App to Phonegap 1.1.0 (from 9.4) and building with the new iOS5 SDK and Xcode 4.2. 我正在将Phonegap应用程序升级到Phonegap 1.1.0(从9.4),并使用新的iOS5 SDK和Xcode 4.2进行构建。

The same happens when trying PhoneGap 1.0.0 as well. 尝试PhoneGap 1.0.0时也会发生相同的情况。

The app has an about button that launches a notification dialog, but it is not firing after upgrading. 该应用程序具有“关于”按钮,可启动通知对话框,但升级后不会触发。

Here is the HTML from the Phonegap App 这是来自Phonegap应用程序的HTML

<!DOCTYPE html>
<html>

<head>

    <script type="text/javascript" charset="utf-8" src="phonegap.1.1.0.min.js"></script>



    <script type="text/javascript" charset="utf-8">


        function onDeviceReady(){
            //do something
        }

function OnPageLoad(){

      document.addEventListener("deviceready",onDeviceReady,false);

}

        function alertDismissed() {
            // do something
        }


function onAlertBtn()
    {
    navigator.notification.alert("Test Alert Message", alertDismissed, "Test Alert", "Done"); 

    }

</script>

</head>

<body onload="OnPageLoad()">

<div align="center">
  <FORM>
<INPUT type="button" style="font-size: 18px;" value="About"  onClick="onAlertBtn();" >
</FORM> </div>

</body>
</html>

Any assistance would be appreciated. 任何援助将不胜感激。

Thanks 谢谢

Ok, after considerable trial and error, a fix has been found! 好吧,经过反复的尝试和错误,已经找到一个解决方法!

Modify the source to be... 将源修改为...

<!DOCTYPE html>
<html>

<head>

<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no;" />

    <meta http-equiv="Content-type" content="text/html; charset=utf-8">

        <link href="css/style.css" rel="stylesheet" media="screen" type="text/css">
            <script type="text/javascript" charset="utf-8" src="phonegap-1.0.0.js"></script>
<script type="text/javascript" charset="utf-8">


        function onDeviceReady(){
            //do something
        }

function OnPageLoad(){

      document.addEventListener("deviceready",onDeviceReady,false);

}

        function alertDismissed() {
            // do something
        }


function onAlertBtn()
    {
    navigator.notification.alert("Test Alert Message", alertDismissed, "Test Alert", "Done"); 

    }

</script>

</head>

<body onload="OnPageLoad()">

<div align="center">
  <FORM>
<INPUT type="button" style="font-size: 18px;" value="About"  onClick="onAlertBtn();" >
</FORM> </div>

</body>
</html>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM