2016-04-25 38 views
2

我試圖在iOS 9.3.1上的phonegap應用程序中顯示iframe。出於某種原因(因此這個問題)iframe顯示在Android上,但不是在IOS上。ios上的phonegap應用程序中的iframe 9.3.1

設置: 1在Mac,我安裝的PhoneGap桌面v0​​.3.1和創建了一個新的應用程序

  • index.html中加入我的IFRAME

    <body> 
        <iframe src="http://www.w3schools.com" style="border-style:solid; width:750px; height:500px;"/> 
        <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> 
    
  • 然後在iPad上測試安裝了PhoneGap的應用程序(https://itunes.apple.com/us/app/phonegap-developer/id843536693?mt=8):在Android上它的工作原理,而在iOS上不顯示出來(我可以看到邊界,而不是內容)

  • 再變config.xml中更寬鬆

    <access origin="*" /> 
    <allow-intent href="*" /> 
    <allow-navigation href="*" /> 
    
    <plugin name="cordova-plugin-whitelist" version="1"/> 
    <allow-intent href="*" /> 
    <allow-navigation href="*" /> 
    
    <platform name="android"> 
        <allow-intent href="*" /> 
    </platform> 
    <platform name="ios"> 
        <allow-intent href="*" /> 
    </platform> 
    
  • 並加入 index.html中

  • 具有相同的結果爲3再次測試
  • 回答

    5

    從Resources-> ProjectName-Info.plist中打開Info.plist文件。

    添加以下詳細信息: 應用程序傳輸安全設置作爲詞典並添加允許任意負載爲真。

    檢查下面的圖像:

    enter image description here

    而第二件事你需要添加外部主機與有*值項0的字符串。檢查下面的圖片:

    enter image description here

    +0

    嗯,所以真正的問題是,可以從iTunes –

    +0

    安裝此上班的PhoneGap開發的應用程序,需要真正建立一個新的應用程序,而不是僅僅使用了通用phonegap應用程序,因爲它沒有所有必要的權限 –

    +0

    當我讀到你的回覆後,我再次嘗試在ipad上構建和運行應用程序,並且這次它甚至在不更改.plist文件的情況下也能正常運行。 僅供參考:這是科爾多瓦產生的.plist文件中: \t NSAllowsArbitraryLoads \t

    相關問題