【问题标题】:Ionic Deploy: $ionicDeploy.load not working离子部署:$ionicDeploy.load 不工作
【发布时间】:2015-07-24 12:17:03
【问题描述】:

我正在尝试 Ionic 部署。似乎一切正常,直到获得更新后再次加载应用程序。我提供了截图。如果还有什么我可以提供的,请告诉我。谢谢。

应用完成下载和解压后控制台出错,然后它会尝试再次加载。

我的网页视图出错

部署脚本中加载方法的离子源代码

我的 javascript 实现:

$ionicPlatform.ready(function() {              
                // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
                // for form inputs)
                if(window.cordova && window.cordova.plugins.Keyboard) {
                    cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
                    screen.lockOrientation('portrait');
                }
                if(window.StatusBar) {
                    StatusBar.styleDefault();
                }
                
                
                // Check for updates
                $ionicDeploy.check().then(function(response) {
                        hide();
                        console.log(response);
                        // response will be true/false
                        if (response) {
                          show('Downloading update...');
                            // Download the updates
                            $ionicDeploy.download().then(function() {
                               hide();
                               show('Extracting update...');
                                // Extract the updates
                                $ionicDeploy.extract().then(function() {
                                    hide();
                                    // Load the updated version
                                    $ionicDeploy.load();
                                }, function(error) {
                                  show('Error extracting new update...');
                                  setTimeout(function(){
                                    hide();
                                  }, 1500);
                                    // Error extracting
                                }, function(progress) {
                                  show('Extract progress...' + progress);
                                  // setTimeout(function(){
                                  //   hide();
                                  // }, 5000);
                                    // Do something with the zip extraction progress
                                    // $scope.extraction_progress = progress;
                                });
                            }, function(error) {
                              show('Error downloading...');
                              setTimeout(function(){
                                hide();
                              }, 1500);
                                // Error downloading the updates
                            }, function(progress) {
                              show('Download progress...' + progress);
                              // setTimeout(function(){
                              //   hide();
                              // }, 5000);
                                // Do something with the download progress
                                // $scope.download_progress = progress;
                            });
                        }
                    },
                    function(error) {
                        // Error checking for updates
                        show('Error checking for updates');
                        setTimeout(function(){
                          hide();
                        }, 1500);
                    });
            });                                                        
        })

【问题讨论】:

    标签: ionic-framework ionic


    【解决方案1】:

    我们之前在通过 Ionic Deploy 下载更新时看到过这个错误,据我所知,这是由过期版本的 javascript 组件 (ionic-service-deploy) 或 Cordova 插件 (com.ionic.deploy) 引起的。

    我认为您最好的做法是将两者都更新到最新版本:

    $ ionic plugin add https://github.com/driftyco/ionic-plugins-deploy
    $ ionic add ionic-service-deploy
    

    然后运行:

    $ ionic platform remove android
    $ ionic platform add android
    $ ionic build android
    

    确保没有旧版本的插件被缓存。

    另一种可能性;您可能在 ID com.ionic.update 下安装了插件(您可以使用 $ cordova plugins list 进行检查)。在这种情况下,您可以通过运行来解决此问题:

    $ cordova plugin remove com.ionic.update
    $ ionic plugin add https://github.com/driftyco/ionic-plugins-deploy
    

    【讨论】:

    • 我完成了上述所有操作,但在完成下载并尝试再次加载应用程序后,我仍然得到这个。 Screenshot of error
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-09-15
    • 1970-01-01
    • 2019-03-12
    • 2017-01-13
    • 2017-03-22
    • 1970-01-01
    • 2019-02-05
    相关资源
    最近更新 更多