2016-12-30 63 views
0

我使用phonegap build构建移动应用程序。我已经为iOS,Android和Windows构建应用程序,并且我正在测试它在TestObject。我在我的应用程序中执行的操作是在页面加载时重定向到http://google.comPhonegap构建应用程序不适用于iOS

的index.html

<!DOCTYPE html> 

<html> 
    <head> 
     <script type="text/javascript" charset="utf-8" src="cordova.js"></script> 
     <script src="https://code.jquery.com/jquery-1.9.1.min.js"></script> 
     <script type="text/javascript" charset="utf-8"> 
      function onLoad() { 
        document.addEventListener("deviceready", onDeviceReady, true); 
      } 

      function onDeviceReady() { 
       window.location.href = "http://google.com"; 
      } 
     </script> 
    </head> 
    <body onload="onLoad();"> 
    </body> 
</html> 

的config.xml

<?xml version="1.0" encoding="UTF-8" ?> 
    <widget xmlns = "http://www.w3.org/ns/widgets" 
     xmlns:gap = "http://phonegap.com/ns/1.0" 
     id   = "com.newApp.mobileApp" 
     versionCode = "1" 
     version  = "1.0.0" > 

    <!-- versionCode is Android only --> 
    <!-- version is in major.minor.patch format --> 
    <name>My New App</name> 

    <description> 
     An example for phonegap build app which wont show up in the playstore. 
    </description> 

    <author href="https://YourWebsite.com" email="[email protected]"> 
     Name Of The Author 
    </author> 

    <plugin name="cordova-plugin-whitelist" source="npm"/> 
</widget> 

当用机器人(apk文件)进行测试时,它被重定向到google.com。但是当我用iOS设备(ipa文件)测试时,它只显示空白页面。

为什么它不适用于iOS?

任何人都可以帮助我解决这个问题吗?提前致谢。

+0

您是否为您的ios设备设置了不限制的选项? ..posto你的config.xml也如果你可以 –

+0

你有错误的标签 - 'PHP' – mishanon

+0

@ federicoscamuzzi..Please看到我更新的问题。 – Jenz

回答

0
<access origin="*" launch-external="yes" /> 
    <allow-intent href="http://*/*" /> 
    <allow-intent href="https://*/*" /> 
    <access origin="http://127.0.0.1*"/> 
    <allow-navigation href="*"/> 
    <allow-intent href="*"/> 

是在关于白名单安全起见,我在我的应用程序

除了上述

使用这些意图,我添加了这个插件为Android

<gap:plugin name="cordova-plugin-whitelist" version="1.1.0" source="npm" /> 

和IOS

<plugin name="cordova-plugin-whitelist" spec="https://github.com/apache/cordova-plugin-whitelist.git" /> 
相关问题