0

我是PhoneGap的新手,我的navigator.notification.alert不起作用。 我使用PhoneGap的從一個樣本項目,只是修改夫婦在config.xml和index.html中PhoneGap navigator.notification.alert在iOS上不起作用

問題行,如果我用的PhoneGap開發被證明了警報,但如果我上傳的zip包構建.phonegap.com和安裝應用 - >未示出警報

config.xml中:

<widget xmlns="http://www.w3.org/ns/widgets" xmlns:gap="http://phonegap.com/ns/1.0" id="com.phonegap.helloworld" version="1.0.0"> 
    <name>HW</name> 
    <description>Hello World sample application that responds to the deviceready event.</description> 
    <author href="http://phonegap.com" email="[email protected]">PhoneGap Team</author> 
    <content src="index.html"/> 
    <preference name="permissions" value="none"/> 
    <preference name="orientation" value="default"/> 
    <preference name="target-device" value="universal"/> 
    <preference name="fullscreen" value="true"/> 
    <preference name="webviewbounce" value="true"/> 
    <preference name="prerendered-icon" value="true"/> 
    <preference name="stay-in-webview" value="false"/> 
    <preference name="ios-statusbarstyle" value="black-opaque"/> 
    <preference name="detect-data-types" value="true"/> 
    <preference name="exit-on-suspend" value="false"/> 
    <preference name="show-splash-screen-spinner" value="true"/> 
    <preference name="auto-hide-splash-screen" value="true"/> 
    <preference name="disable-cursor" value="false"/> 
    <preference name="android-minSdkVersion" value="14"/> 
    <preference name="android-installLocation" value="auto"/> 
    <gap:plugin name="org.apache.cordova.battery-status"/> 
    <gap:plugin name="org.apache.cordova.camera"/> 
    <gap:plugin name="org.apache.cordova.media-capture"/> 
    <gap:plugin name="org.apache.cordova.console"/> 
    <gap:plugin name="org.apache.cordova.contacts"/> 
    <gap:plugin name="org.apache.cordova.device"/> 
    <gap:plugin name="org.apache.cordova.device-motion"/> 
    <gap:plugin name="org.apache.cordova.device-orientation"/> 
    <gap:plugin name="org.apache.cordova.file"/> 
    <gap:plugin name="org.apache.cordova.file-transfer"/> 
    <gap:plugin name="org.apache.cordova.geolocation"/> 
    <gap:plugin name="org.apache.cordova.globalization"/> 
    <gap:plugin name="org.apache.cordova.inappbrowser"/> 
    <gap:plugin name="org.apache.cordova.media"/> 
    <gap:plugin name="org.apache.cordova.network-information"/> 
    <gap:plugin name="org.apache.cordova.splashscreen"/> 
    <gap:plugin name="org.apache.cordova.vibration"/> 
    <icon src="icon.png"/> 
    <icon src="www/res/icon/android/icon-36-ldpi.png" gap:platform="android" gap:qualifier="ldpi"/> 
    <icon src="www/res/icon/android/icon-48-mdpi.png" gap:platform="android" gap:qualifier="mdpi"/> 
    <icon src="www/res/icon/android/icon-72-hdpi.png" gap:platform="android" gap:qualifier="hdpi"/> 
    <icon src="www/res/icon/android/icon-96-xhdpi.png" gap:platform="android" gap:qualifier="xhdpi"/> 
    <icon src="www/res/icon/blackberry/icon-80.png" gap:platform="blackberry"/> 
    <icon src="www/res/icon/blackberry/icon-80.png" gap:platform="blackberry" gap:state="hover"/> 
    <icon src="www/res/icon/ios/icon-57.png" gap:platform="ios" width="57" height="57"/> 
    <icon src="www/res/icon/ios/icon-72.png" gap:platform="ios" width="72" height="72"/> 
    <icon src="www/res/icon/ios/icon-57-2x.png" gap:platform="ios" width="114" height="114"/> 
    <icon src="www/res/icon/ios/icon-72-2x.png" gap:platform="ios" width="144" height="144"/> 
    <icon src="www/res/icon/webos/icon-64.png" gap:platform="webos"/> 
    <icon src="www/res/icon/windows-phone/icon-48.png" gap:platform="winphone"/> 
    <icon src="www/res/icon/windows-phone/icon-173-tile.png" gap:platform="winphone" gap:role="background"/> 
    <gap:splash src="www/res/screen/android/screen-ldpi-portrait.png" gap:platform="android" gap:qualifier="port-ldpi"/> 
    <gap:splash src="www/res/screen/android/screen-mdpi-portrait.png" gap:platform="android" gap:qualifier="port-mdpi"/> 
    <gap:splash src="www/res/screen/android/screen-hdpi-portrait.png" gap:platform="android" gap:qualifier="port-hdpi"/> 
    <gap:splash src="www/res/screen/android/screen-xhdpi-portrait.png" gap:platform="android" gap:qualifier="port-xhdpi"/> 
    <gap:splash src="www/res/screen/blackberry/screen-225.png" gap:platform="blackberry"/> 
    <gap:splash src="www/res/screen/ios/screen-iphone-portrait.png" gap:platform="ios" width="320" height="480"/> 
    <gap:splash src="www/res/screen/ios/screen-iphone-portrait-2x.png" gap:platform="ios" width="640" height="960"/> 
    <gap:splash src="www/res/screen/ios/screen-iphone-portrait-568h-2x.png" gap:platform="ios" width="640" height="1136"/> 
    <gap:splash src="www/res/screen/ios/screen-ipad-portrait.png" gap:platform="ios" width="768" height="1024"/> 
    <gap:splash src="www/res/screen/ios/screen-ipad-landscape.png" gap:platform="ios" width="1024" height="768"/> 
    <gap:splash src="www/res/screen/windows-phone/screen-portrait.jpg" gap:platform="winphone"/> 
    <access origin="*"/> 
    <plugin name="cordova-plugin-whitelist" version="1"/> 
    <plugin name="cordova-plugin-dialogs" version="1"/> 
    <feature name="Notification"> 
    <param name="ios-package" value="CDVNotification" /> 
    </feature> 
    <allow-intent href="http://*/*"/> 
    <allow-intent href="https://*/*"/> 
    <allow-intent href="tel:*"/> 
    <allow-intent href="sms:*"/> 
    <allow-intent href="mailto:*"/> 
    <allow-intent href="geo:*"/> 
    <platform name="android"> 
    <allow-intent href="market:*"/> 
    </platform> 
    <platform name="ios"> 
    <allow-intent href="itms:*"/> 
    <allow-intent href="itms-apps:*"/> 
    </platform> 
</widget> 

和index.html

<html> 
    <head> 
     <meta charset="utf-8" /> 
     <meta name="format-detection" content="telephone=no" /> 
     <meta name="msapplication-tap-highlight" content="no" /> 
     <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" /> 
     <link rel="stylesheet" type="text/css" href="css/index.css" /> 
     <title>Hello World</title> 
    </head> 
    <body onload='navigator.notification.alert("Fine!", null, "blablabla", "OK");'> 
     <div class="app"> 
      <h1>PhoneGap</h1> 
      <div id="deviceready" class="blink"> 
       <p class="event listening">Connecting to Device</p> 
       <p class="event received">Device is Ready</p> 
      </div> 
     </div> 
     <script type="text/javascript" src="cordova.js"></script> 
     <script type="text/javascript" src="js/index.js"></script> 
     <script type="text/javascript"> 
      app.initialize(); 
     </script> 
    </body> 
</html> 

有什麼不對?謝謝

+0

你還有問題嗎? – JesseMonroy650

+0

是的。我仍然無法提醒 –

+0

好吧給我一些時間閱讀您的文章。 – JesseMonroy650

回答

0

@Alexey
這是文檔的常見問題。我問Phonegap to fix it但沒有。

答案是你不能使用Phonegap Build取代Phonegap桌面/開發應用程序。他們是爲了一起工作。

您可以使用

  • Phoengap CLI
  • OR
  • 的PhoneGap構建

的PhoneGap構建需要兩(2)文件 - index.html和​​3210,沒有別的。它確實不是一起使用Phonegap開發人員應用程序

Phonegap CLI的一部分Phonegap桌面應用程序。您可以使用Phonegap CLI,但不要再使用Phonegap開發者應用程序

要明確:

  • 的PhoneGap構建PhoneGap的CLI是製作獨立的應用程序。
  • Phonegap桌面應用程序Phonegap開發人員應用程序一起工作。

當你完成Phonegap桌面應用程序 - 你已經完成了。不要再使用它。移至Phonegap BuildPhonegap CLI。我相信這很清楚。

+0

這並不能說明我的情況......應該如何創建_Phonegap Build_應用程序?使用CLI?我的應用程序最初是使用CLI創建的。我正在使用_Phonegap開發人員App_ –

+0

在電話上檢查它。這不是你的問題。你的問題是:*什麼是錯的?*我已經回答了這個問題。 - 要清楚的是,你的新問題有一個答案,但你正在問一個新問題。你現在可以 - 在stackoverflow上提出一個新問題,或者在另一個論壇上提問。我建議[Google Cordova/Phonegap](https://groups.google.com/forum/#!forum/phonegap)。請鏈接到新問題,以便我可以回覆。 – JesseMonroy650

+0

問題的主題是「PhoneGap navigator.notification.alert在iOS上不起作用」 –

相關問題