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

前端之家收集整理的这篇文章主要介绍了xcode – ion无法加载带有错误的网页:无法连接到服务器前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
在更新到 Xcode 6和iOS 8之后,我遇到了Ionic项目的问题.

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

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

完整的日志是:

  1. 2014-10-11 14:08:29.468 test[23293:109668] Apache Cordova native platform version 3.6.3 is starting.
  2. 2014-10-11 14:08:29.469 test[23293:109668] Multi-tasking -> Device: YES,App: YES
  3. 2014-10-11 14:08:29.495 test[23293:109668] Unlimited access to network resources
  4. 2014-10-11 14:08:29.866 test[23293:109668] [CDVTimer][keyboard] 0.079989ms
  5. 2014-10-11 14:08:29.866 test[23293:109668] [CDVTimer][TotalPluginStartup] 0.284970ms
  6. 2014-10-11 14:08:30.721 test[23293:109668] Resetting plugins due to page load.
  7. 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的:

  1. <!DOCTYPE html>
  2. <html ng-app="app" ng-controller="AppCtrl">
  3. <head>
  4. <Meta charset="utf-8">
  5. <Meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no,width=device-width">
  6.  
  7. <!-- compiled CSS -->
  8. <link rel="stylesheet" type="text/css" href="assets/app-0.0.1.css" />
  9.  
  10. <!-- compiled JavaScript -->
  11. <script type="text/javascript" src="src/app/app.js"></script>
  12.  
  13. <!-- cordova script (this will be a 404 during development) -->
  14. <script src="cordova.js"></script>
  15. </head>
  16. <body >
  17. <ion-nav-view></ion-nav-view>
  18.  
  19.  
  20. <!-- Load deferred scripts -->
  21.  
  22. <!-- Google Maps -->
  23. <script src='http://maps.googleapis.com/maps/api/js?sensor=true&callback=googleMapsLoaded' defer async></script>
  24. </body>
  25. </html>

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

  1. angular.module( 'app',[
  2. 'ionic',// Common requirements
  3. 'templates-app','templates-common',// Common Components
  4. 'app.auth',// All page modules
  5. 'app.businesses','app.business','app.search','app.branch','app.profile','app.Feed',// Other dependencies
  6. 'ui.router'
  7. ])
  8.  
  9. .config(['$stateProvider','$urlRouterProvider',function myAppConfig ($stateProvider,$urlRouterProvider) {
  10. $stateProvider
  11. .state('app',{
  12. url: "/app",abstract: true,templateUrl: "menu/menu.tpl.html",controller: 'AppCtrl'
  13. });
  14.  
  15. $urlRouterProvider.otherwise( 'app/Feed' );
  16. }])
  17.  
  18. .run(['$ionicPlatform','appAuthService','$sessionStorage',function($ionicPlatform,appAuthService,$sessionStorage) {
  19. // Initialize ionic styles
  20. $ionicPlatform.ready(function() {
  21. if(window.StatusBar) {
  22. // org.apache.cordova.statusbar required
  23. StatusBar.styleDefault();
  24. StatusBar.styleLightContent();
  25. }
  26. });
  27.  
  28. // Initialize app authentication service
  29. appAuthService.init();
  30.  
  31. // Initialize a session cache validation object
  32. $sessionStorage.updated = {};
  33. }])
  34.  
  35. .controller( 'AppCtrl',['$scope','$location',function AppCtrl ($scope,$location) {
  36.  
  37. }])
  38.  
  39. ;

解决方法

我有同样的问题.

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

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

  1. ionic prepare ios

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

猜你在找的iOS相关文章