2014-10-11 74 views
20

我有更新到Xcode的6和iOS 8離子無法加載,錯誤的網頁:無法連接到服務器

當試圖運行項目我碰到下面的錯誤後,用離子項目的問題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. 

即使試圖更新離子和科爾多瓦和開始一個新項目此錯誤不斷彈出。

我找不到有這個特定錯誤的任何線程,我不確定這是iOS 8的兼容性問題,還是有些東西與我的設置搞砸了。

謝謝!

編輯:

<!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(與其他編譯前:什麼是在index.html,然後app.js

的index.html

多一點信息使用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) { 

}]) 

; 
+0

您是否驗證過要連接的服務器是否可用? – 2014-10-11 11:19:27

+0

你需要向我們展示你的'index.html'是如何編碼的。需要提供更多信息? – frank 2014-10-11 13:07:03

+0

@ScottHunter我有,但即使它不可用,應用程序的資源是本地離子應仍然加載,不應該嗎? – BarakChamo 2014-10-11 23:21:26

回答

69

我有同樣的問題。

我通過Xcode在平臺文件夾中打開了ios項目,但我忘記了Xcode文件夾中的代碼庫不是最新的,因此破壞了。

爲了讓您的Xcode項目的新代碼中使用命令:

ionic prepare ios 

如果您的問題植根於我的一樣這應該幫助。

+2

這也解決了它對我來說,但在Ionic 2測試版11. – DarkNeuron 2016-08-15 11:24:43

+0

非常感謝..這是工作 – CodeWriter 2018-01-14 17:48:31

+2

在新版本的離子cordova準備ios' – Chumillas 2018-02-20 18:05:19

相關問題