xcode – ion无法加载带有错误的网页:无法连接到服务器

在更新到 Xcode 6和iOS 8之后,我遇到了Ionic项目的问题.

当尝试运行项目时,我在Xcode中收到以下错误:

Failed to load webpage with error: Could not connect to the server.

完整的日志是:

2014-10-11 14:08:29.468 test[23293:109668] Apache Cordova native platform version 3.6.3 is starting.
2014-10-11 14:08:29.469 test[23293:109668] Multi-tasking -> Device: YES,App: YES
2014-10-11 14:08:29.495 test[23293:109668] Unlimited access to network resources
2014-10-11 14:08:29.866 test[23293:109668] [CDVTimer][keyboard] 0.079989ms
2014-10-11 14:08:29.866 test[23293:109668] [CDVTimer][TotalPluginStartup] 0.284970ms
2014-10-11 14:08:30.721 test[23293:109668] Resetting plugins due to page load.
2014-10-11 14:08:30.764 test[23293:109668] Failed to load webpage with error: Could not connect to the server.

即使尝试更新Ionic和Cordova并开始一个新项目,这个错误也不断出现.

我找不到任何线程与这个特定的错误,我不知道这是否是一个iOS 8兼容性问题或某些东西搞砸了我的设置.

谢谢!

编辑:

更多关于index.html和app.js中的内容的信息

index.html的:

<!DOCTYPE html>
<html ng-app="app" ng-controller="AppCtrl">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no,width=device-width">

    <!-- compiled CSS -->
    <link rel="stylesheet" type="text/css" href="assets/app-0.0.1.css" />

    <!-- compiled JavaScript -->
    <script type="text/javascript" src="src/app/app.js"></script>

    <!-- cordova script (this will be a 404 during development) -->
    <script src="cordova.js"></script>
  </head>
  <body >
    <ion-nav-view></ion-nav-view>


    <!-- Load deferred scripts -->

    <!-- Google Maps -->
    <script src='http://maps.googleapis.com/maps/api/js?sensor=true&callback=googleMapsLoaded' defer async></script>
  </body>
</html>

和app.js(在使用ngbp编译其余的文件之前):

angular.module( 'app',[
  'ionic',// Common requirements
  'templates-app','templates-common',// Common Components
  'app.auth',// All page modules
  'app.businesses','app.business','app.search','app.branch','app.profile','app.feed',// Other dependencies
  'ui.router'
])

.config(['$stateProvider','$urlRouterProvider',function myAppConfig ($stateProvider,$urlRouterProvider) {
  $stateProvider
  .state('app',{
    url: "/app",abstract: true,templateUrl: "menu/menu.tpl.html",controller: 'AppCtrl'
  });

  $urlRouterProvider.otherwise( 'app/feed' );
}])

.run(['$ionicPlatform','appAuthService','$sessionStorage',function($ionicPlatform,appAuthService,$sessionStorage) {
  // Initialize ionic styles
  $ionicPlatform.ready(function() {
    if(window.StatusBar) {
      // org.apache.cordova.statusbar required
      StatusBar.styleDefault();
      StatusBar.styleLightContent();
    }
  });

  // Initialize app authentication service
  appAuthService.init();

  // Initialize a session cache validation object
  $sessionStorage.updated = {};
}])

.controller( 'AppCtrl',['$scope','$location',function AppCtrl ($scope,$location) {

}])

;

解决方法

我有同样的问题.

我通过Xcode在平台文件夹中打开了ios项目,但是我忘记了Xcode文件夹中的代码库不是最新的,因此被破坏.

要获取Xcode项目中的新代码,请使用以下命令:

ionic prepare ios

如果你的问题根植于我的这个应该是有帮助的.

相关文章

当我们远离最新的 iOS 16 更新版本时,我们听到了困扰 Apple...
欧版/美版 特别说一下,美版选错了 可能会永久丧失4G,不过只...
一般在接外包的时候, 通常第三方需要安装你的app进行测...
前言为了让更多的人永远记住12月13日,各大厂都在这一天将应...