【问题标题】:Phonegap build app not working for iOSPhonegap 构建应用程序不适用于 iOS
【发布时间】:2017-05-14 16:05:08
【问题描述】:

我正在使用 phonegap build 构建移动应用程序。我已经为 iOS、Android 和 Windows 构建了应用程序,我正在 TestObject 中对其进行测试。我在我的应用程序中所做的是在页面加载本身时重定向到http://google.com

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="yourEmail@goesHere.com">
        Name Of The Author
    </author>

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

在使用 android(apk 文件)进行测试时,它会重定向到 google.com。但是当我使用 iOS 设备(ipa 文件)进行测试时,它只显示空白页。

为什么它不适用于 iOS?

谁能帮我解决这个问题?提前致谢。

【问题讨论】:

  • 您是否为您的 ios 设备设置了不限制选项? ..posto 你的 config.xml 也可以
  • 你有错误的标签 - 'PHP'
  • @federicoscamuzzi..请查看我更新的问题。
  • 可以不用inappbrowser插件吗?
  • @Naitik..我尝试在 config.xml 文件中添加&lt;plugin name="cordova-plugin-inappbrowser" source="npm"/&gt;。但是还是不行。

标签: ios cordova phonegap-build


【解决方案1】:
<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" />

【讨论】:

    猜你喜欢
    • 2016-06-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-03-05
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多