Ionic就绪事件未在iOS

时间:2016-08-27 22:33:41

标签: ios cordova ionic-framework

我有一个Ionic应用程序,可以在Android和iOS模拟器上完美运行,但不适用于实际的iOS设备(我使用离子包来构建它)。当我运行应用程序时,会发生以下情况:

我第一次运行它:就绪事件是而不是被触发,但是我的家庭控制器显示并且正常运行。

所以我关闭应用程序并重新打开它。

我第二次运行它:准备好的事件解雇,我初始化各种事情,包括推送和广告。但是,我不会被问到是否希望我的手机接收通知,而且我看不到任何广告。

所以我再次关闭应用程序。此时(应用程序刚刚关闭时)我询问了通知,所以我同意然后重新打开该应用。

我第三次运行它:再次触发就绪事件,所有内容再次初始化并显示广告。

我已经尝试了很多东西,包括在index.html中重新排序脚本,手动引导以及大量的try / catchs来找出 - 如果有的话 - 失败了。我很难过并且很欣赏这些想法。

的index.html

<head>

<link href="lib/ionic/css/ionic.min.css" rel="stylesheet">
<link href="css/styles.min.css" rel="stylesheet">

<script src="lib/ionic/js/ionic.bundle.min.js"></script>
<script src="cordova.js"></script>

<script src="js/app.js"></script>
<script src="js/controllers.js"></script>
<script src="js/directives.js"></script>
<script src="js/services.js"></script>

</head>

<body ng-app="fwp">

etc

app.js(注意:始终调用对Statics.getAllCompetitions的调用并且总是成功)

angular.module("fwp", ["ionic", "fwp.controllers", "fwp.directives", "fwp.services"])

.run(function ($http, $ionicPlatform, $ionicPopup, $state, Statics) {

    $ionicPlatform.ready(function () {

        //hide the accessory bar by default
        if ((window.cordova)&&(window.cordova.plugins)&&(window.cordova.plugins.Keyboard)) {

            //hide keyboard accessory bar
            cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);

        }

        //status bar found
        if (window.StatusBar) {

            //style status bar
            StatusBar.styleLightContent();

        }

        //initialise everything

    });

})

.config(function ($ionicConfigProvider, $stateProvider, $urlRouterProvider) {

    //remove back label
    $ionicConfigProvider.backButton.previousTitleText(false).text("");

    // Ionic uses AngularUI Router which uses the concept of states
    // Learn more here: https://github.com/angular-ui/ui-router
    // Set up the various states which the app can be in.
    // Each state's controller can be found in controllers.js
    $stateProvider

        // setup an abstract state for the tabs directive
        .state("tab", {
            url: "/tab",
            abstract: true,
            templateUrl: "templates/tabs.html"
        })

        .state("tab.home", {
            cache: false,
            url: "/home",
            views: {
                "tab-home": {
                    templateUrl: "templates/mainMenu.html",
                    resolve: {
                        allCompetitions: function (Statics) {
                            return Statics.getAllCompetitions();
                        }
                    },
                    controller: "HomeCtrl"
                }
            }
        })

        etc

0 个答案:

没有答案
相关问题