2015-10-27 55 views
0

我正在構建使用jquery移動導航的phonegap應用程序。我有一個外部的PHP頁面查詢來自Db的項目並將它們加載到我的應用程序。所以我用外部php頁面未在APK中加載,但在紋波模擬器中工作

$(document).delegate("#cardslist", "pageinit", function() {  
    $.mobile.changePage("data/card-list.html", { transition: "fade", changeHash: false }); 
    ); 
}); 

其中卡list.html是一個內部頁面,其內容爲

$(document).delegate(".cardslist", "pageinit", function() {   
    $.ajax({ 
    method:'GET', 
    url:'http://www.thecardguys.co.ke/m/card-list-mobile.php', 
    beforeSend:function() 
    { 
    // $("#processing").show(); 
    }, 

complete:function() 
    { 
    // $("#processing").hide(); 
    }, 
success: function(feedback) 
    { 
    $('.cardlist').html(feedback); 
    $('.cardlist').css({'transform': 'scale(0.6)'});     
    } 


    }); 
    } 

http://www.thecardguys.co.ke/m/card-list-mobile.php是外部PHP頁面,獲取數據,並呼應它。

內容在紋波模擬器中載入良好,但是當我捆綁應用程序時數據將無法載入。已經過了一週的時間

回答

2

確保將www.thecardguys.co.ke添加到您的網絡請求白名單(請參閱whitelist plugin)。由於您要求非安全網址,你還需要設置傳輸安全關閉IOS9該URL(以下內容添加到您的plist):

<key>NSAppTransportSecurity</key> 
<dict> 
    <key>NSExceptionDomains</key> 
    <dict> 
     <key>www.thecardguys.co.ke</key> 
     <dict> 
      <key>NSIncludesSubdomains</key> 
      <true/> 
      <key>NSExceptionAllowsInsecureHTTPLoads</key> 
      <true/> 
      <key>NSExceptionRequiresForwardSecrecy</key> 
      <false/> 
     </dict> 
    </dict> 
</dict> 

或作出HTTPS鏈接運行。欲瞭解更多信息,請參閱How do I load an HTTP URL with App Transport Security enabled in iOS 9?)和Ajax Not working in IOS 9.0 Cordova和蘋果​​。

+0

嘿,謝謝你的回覆,我在網絡白名單上添加了網址。但它仍然顯示加載器,但不加載Feed。我試過https,這甚至不能加載模擬器。 – jonah

+0

@jonah沒有更多的細節,我可以添加更多。既然你有一個APK,而不是自己構建它,那麼獲得任何調試信息將會很困難。如果您可以使用Cordova CLI自己構建它,則可以使用Safari或GapDebug(https://www.genuitec.com/products/gapdebug/)。如果您正在使用PhoneGapBuild,則它們提供調試工具來確定發生了什麼問題(http://docs.build.phonegap.com/en_US/debugging_remote_debugging_tools.md.html#Remote%20Debugging%20Tools)。 –

+0

我沒有使用任何APK調試器。讓我試試genuitec.com/products/gapdebug – jonah

相關問題