Cordova/appFramework应用在iOS上显示为空白



我用Cordova和appFramework开发了一个非常简单的混合移动应用。

index.html看起来像这样

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="format-detection" content="telephone=no" />
    <!-- WARNING: for iOS 7, remove the width=device-width and
    height=device-height attributes. See https://issues.apache.org
    /jira/browse/CB-4323 -->
    <meta name="viewport" content="user-scalable=no, initial-scale=1,
    maximum-scale=1, minimum-scale=1, width=device-width, 
    height=device-height, target-densitydpi=device-dpi" />
    <link rel="stylesheet" type="text/css" href="css/index.css" />
    <link rel="stylesheet" type="text/css" href="css/af/main.css"  />
    <link rel="stylesheet" type="text/css" href="css/af/appframework.css" />
    <link rel="stylesheet" type="text/css" href="css/af/lists.css"  />
    <link rel="stylesheet" type="text/css" href="css/af/forms.css"  />
    <link rel="stylesheet" type="text/css" href="css/af/buttons.css"  />
    <link rel="stylesheet" type="text/css" href="css/af/badges.css"  />      
    <link rel="stylesheet" type="text/css" href="css/af/grid.css"  />
    <link rel="stylesheet" type="text/css" href="css/af/android.css"  />
    <link rel="stylesheet" type="text/css" href="css/af/win8.css"  />
    <link rel="stylesheet" type="text/css" href="css/af/bb.css"  />
    <link rel="stylesheet" type="text/css" href="css/af/ios.css"  />
    <link rel="stylesheet" type="text/css" href="css/af/ios7.css"  />
    <link rel="stylesheet" type="text/css" href="css/af/tizen.css"  />
    <title>Cordova Application</title>
    <script type="text/javascript" charset="utf-8"
    src="js/vendor/appframework.js"></script>
    <script type="text/javascript" charset="utf-8" 
    src="js/vendor/plugins/af.scroller.js"></script>
    <script type="text/javascript" charset="utf-8" 
    src="js/vendor/plugins/af.css3animate.js"></script>
    <script type="text/javascript" charset="utf-8" 
    src="js/vendor/ui/appframework.ui.js"></script>
    <script type="text/javascript" charset="utf-8" 
    src="js/vendor/ui/transitions/fade.js"></script>
    <script type="text/javascript" charset="utf-8" 
    src="js/vendor/ui/transitions/flip.js"></script>
    <script type="text/javascript" charset="utf-8" 
    src="js/vendor/ui/transitions/pop.js"></script>
    <script type="text/javascript" charset="utf-8" 
    src="js/vendor/ui/transitions/slide.js"></script>
    <script type="text/javascript" charset="utf-8" 
    src="js/vendor/ui/transitions/slideDown.js"></script>
    <script type="text/javascript" charset="utf-8" 
    src="js/vendor/ui/transitions/slideUp.js"></script>
    <script type="text/javascript" charset="utf-8" 
    src="js/vendor/plugins/af.slidemenu.js"></script>
    <script>
        $.ui.ready(function () {
            console.log("UI Ready!!!");
        });
        $(document).ready(function() {
            console.log('Document Ready...');
            alert('Document Ready...');
        });
    </script>
</head>
<body>
    <div id="afui">
        <div id="header">
        </div>
        <div id="content">
            <div data-title="Home" class="panel"
                                 id="main" selected="true">
                <span>THIS is the HOME Page!</span>
            </div>
            <div data-title="Second Page" class="panel" id="second">
            </div>
        </div>
        <nav>
            <div class="title">Nav Home</div>
            <ul>
                <li><a class="icon home mini"
                                    href="#main">Home Link</a></li>
                <li><a class="icon mini"
                                    href="#second">Second Link</a></li>
            </ul>
        </nav>
    </div>
    <script type="text/javascript" src="cordova.js"></script>
</body>
</html>

在Safari或Chrome桌面浏览器中打开时,这显示正确,甚至导航也连接起来了。

但是如果我在iOS或Android模拟器中运行它,我会看到警报"文档准备好了",然后是空白页。

不显示主面板。

下面是我运行模拟器的操作。

 cordova emulate ios
 cordova emulate android

即使我直接从平台构建中打开index.html文件,它们也会正确显示在桌面浏览器上。

我对这一切都很陌生,所以我可能在这里错过了步骤。

你不需要所有碎片化的appframework js和css文件,你可以只包括2个css和1个js文件,这里是更新的代码,它可以作为android上的cordova应用程序,我用Intel XDK构建cordova应用程序。

<!DOCTYPE html>
<html>
<head>
    <title>XDK</title>
    <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0;" />
    <link rel="stylesheet" type="text/css" href="css/af.ui.css" />
    <link rel="stylesheet" type="text/css" href="css/icons.css" />
    <script type="text/javascript" charset="utf-8" src="js/appframework.ui.min.js"></script>
    <script>
        $.ui.ready(function () {
            console.log("UI Ready!!!");
        });
        $(document).ready(function() {
            console.log('Document Ready...');
            alert('Document Ready...');
        });
    </script>
</head>
<body>
    <div id="afui">
        <div id="header">
        </div>
        <div id="content">
            <div title="Home" class="panel" id="main" selected="true">
                <span>THIS is the HOME Page!</span>
            </div>
            <div title="Second Page" class="panel" id="second">
            </div>
        </div>
        <nav>
            <div class="title">Nav Home</div>
            <ul class="list">
                <li><a class="icon home mini" href="#main">Home Link</a></li>
                <li><a class="icon mini" href="#second">Second Link</a></li>
            </ul>
        </nav>
    </div>
    <script type="text/javascript" src="cordova.js"></script>
</body>
</html>

相关内容

  • 没有找到相关文章

最新更新