iPhone 上的 Phonegap 应用触发 "Frame load interrupted" 错误

Phonegap app on iPhone triggers "Frame load interrupted" error

我构建了一个混合 Phonegap 应用程序。我是 Android 用户,所以我已经在 KitKat 上测试过它,并且它有效。我已将其发送给我的客户,他是 iPhone 用户,他向我发送了以下屏幕截图:

Config.xml

<?xml version='1.0' encoding='utf-8'?>
<widget id="com.swapco.swapco" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:gap="http://phonegap.com/ns/1.0" xmlns:android="http://schemas.android.com/apk/res/android">
    <name>SwapCo</name>
    <description>
        SwapCo
    </description>
    <author email="support@phonegap.com" href="http://phonegap.com">
        SwapCo
    </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="10" />
    <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.dialogs" />
    <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 gap:platform="android" gap:qualifier="ldpi" src="www/res/icon/android/icon.png" />
    <icon gap:platform="android" gap:qualifier="mdpi" src="www/res/icon/android/icon.png" />
    <icon gap:platform="android" gap:qualifier="hdpi" src="www/res/icon/android/icon.png" />
    <icon gap:platform="android" gap:qualifier="xhdpi" src="www/res/icon/android/icon.png" />
    <icon gap:platform="blackberry" src="www/res/icon/blackberry/icon-80.png" />
    <icon gap:platform="blackberry" gap:state="hover" src="www/res/icon/blackberry/icon-80.png" />
    <icon gap:platform="ios" height="57" src="www/res/icon/ios/icon.png" width="57" />
    <icon gap:platform="ios" height="72" src="www/res/icon/ios/icon.png" width="72" />
    <icon gap:platform="ios" height="114" src="www/res/icon/ios/icon.png" width="114" />
    <icon gap:platform="ios" height="144" src="www/res/icon/ios/icon.png" width="144" />
    <icon gap:platform="webos" src="www/res/icon/webos/icon-64.png" />
    <icon gap:platform="winphone" src="www/res/icon/windows-phone/icon-48.png" />
    <icon gap:platform="winphone" gap:role="background" src="www/res/icon/windows-phone/icon-173-tile.png" />
    <gap:splash gap:platform="android" gap:qualifier="port-ldpi" src="www/res/screen/android/screen-ldpi-portrait.png" />
    <gap:splash gap:platform="android" gap:qualifier="port-mdpi" src="www/res/screen/android/screen-mdpi-portrait.png" />
    <gap:splash gap:platform="android" gap:qualifier="port-hdpi" src="www/res/screen/android/screen-hdpi-portrait.png" />
    <gap:splash gap:platform="android" gap:qualifier="port-xhdpi" src="www/res/screen/android/screen-xhdpi-portrait.png" />
    <gap:splash gap:platform="blackberry" src="www/res/screen/blackberry/screen-225.png" />
    <gap:splash gap:platform="ios" height="480" src="www/res/screen/ios/screen-iphone-portrait.png" width="320" />
    <gap:splash gap:platform="ios" height="960" src="www/res/screen/ios/screen-iphone-portrait-2x.png" width="640" />
    <gap:splash gap:platform="ios" height="1136" src="www/res/screen/ios/screen-iphone-portrait-568h-2x.png" width="640" />
    <gap:splash gap:platform="ios" height="1024" src="www/res/screen/ios/screen-ipad-portrait.png" width="768" />
    <gap:splash gap:platform="ios" height="768" src="www/res/screen/ios/screen-ipad-landscape.png" width="1024" />
    <gap:splash gap:platform="winphone" src="www/res/screen/windows-phone/screen-portrait.jpg" />
    <access origin="*" />
    <plugin name="cordova-plugin-whitelist" version="1" />
    <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>
    <engine name="android" spec="^4.0.0" />
    <engine name="ios" spec="^3.8.0" />
     <feature name="Camera">
         <param name="android-package" value="org.apache.cordova.camera.CameraLauncher" />
    </feature>

    <gap:config-file platform="android" parent="/manifest">
         <application android:debuggable="true" />
    </gap:config-file>
</widget>

index.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
    <title>XXX</title>
    <!-- Latest compiled and minified CSS -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">

    <!-- Optional theme -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">

    <link rel="stylesheet" href="css/style.css">


    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body>
<div class="container">
    <div class="row">
        <div class=" col-xs-4 col-xs-push-4 col-sm-4 col-sm-push-4 col-md-2 col-md-push-5">
            <img src="images/logo.png" class="img-responsive center-block logo">
        </div>
    </div>
    <div class="row">
        <div class=" col-xs-12 col-sm-8 col-sm-push-2 col-md-4 col-md-push-4">
            <br />
            <h2 class="text-center white">Welcome!</h2>
            <p class="text-center white">Selling made simple.</p>
            <div class="input-area" style="margin-top:60px">
                <input id="username" type="text">
                <span class="icon"><i class="fa fa-user"></i> </span>
            </div>
            <div class="input-area">
                <input id="password" type="password">
                <span class="icon"><i class="fa fa-key"></i> </span>
            </div>
        </div>

<div class="bottom-buttons">
    <button type="button" onclick="authenticate()"  class="btn signin pull-left">SIGN IN</button>
    <a href="signup.html"><button type="button"  class="btn signup pull-right">SIGN UP</button></a>
</div>
    </div>
</div>

<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="js/jquery.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->

<!-- Latest compiled and minified JavaScript -->
<script src="js/bootstrap.min.js"></script>
<script src="js/index.js"></script>
</body>
</html>

我是苹果新手,欢迎大家多多指教。顺便说一句,我正在为 iOS 构建使用开发证书,并且我已经将他的 iPhone 链接到它们。

编辑

以下是我注意到的一些事情:

  • index.html
  • 中缺少 <script type="text/javascript" src="cordova.js"></script>
  • <plugin name="cordova-plugin-whitelist" version="1" />中的version应该设置为1.0.0
  • 此外,我不确定在没有此元标记 <meta http-equiv="Content-Security-Policy" content="default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *"> 的情况下它在 Android 上是如何工作的。在 Content-Security-Policy.
  • 上查找更多信息

没有任何代码,我无法提出任何建议,但我在 Stack Overflow 上发现了这个 question,它似乎对您有所帮助。

似乎是一个 URL 问题。

对于 iOS,请确保您遵循 iOS 9+

的 ATS 应用传输政策

如果您想访问外部 URL,您可以将 属性 设置为 arbitraryloads true。

示例PhoneGap: modify config.xml to add properties to Info.plist ion iOS

它在 iOS 模拟器中工作吗?

问题出在证书上。

为了解决这个问题,我颁发了分发(而不是开发)证书,两个条款(本地测试和 AppStore 的 Ad Hoc),然后它就起作用了。