2014-10-11 18 views
20

Tôi đang gặp sự cố với dự án Ionic sau khi cập nhật lên Xcode 6 và iOS 8.ionic Không thể tải trang web có lỗi: Không thể kết nối với máy chủ

Khi cố gắng chạy dự án, tôi nhận được lỗi sau Xcode:

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

Nhật ký đầy đủ là:

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. 

Ngay cả khi cố gắng cập nhật Ionic và Cordova và bắt đầu một dự án mới được lỗi này giữ popping lên.

Tôi không thể tìm thấy bất kỳ chủ đề nào có lỗi cụ thể này và tôi không chắc đây có phải là vấn đề tương thích với iOS 8 hay không, hoặc có vấn đề gì đó xảy ra với thiết lập của tôi.

Cảm ơn!

EDIT:

hơn Một chút thông tin về những gì trong index.html và 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> 

và app.js (trước khi biên dịch với phần còn lại của các tệp sử dụng 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

Bạn đã xác minh rằng máy chủ bạn muốn kết nối thậm chí có sẵn không? –

+0

bạn cần cho chúng tôi biết cách 'index.html' của bạn đã được mã hóa. Cần cung cấp thêm thông tin? – frank

+0

@ScottHunter Tôi có, mặc dù ngay cả khi nó không có sẵn và tài nguyên của ứng dụng là ion địa phương vẫn nên tải, phải không? – BarakChamo

Trả lời

69

Tôi đã gặp vấn đề tương tự.

Tôi đã mở dự án ios trong thư mục nền tảng qua Xcode, nhưng tôi quên rằng mã trong thư mục Xcode không được cập nhật và do đó bị hỏng.

Để lấy mã mới trong dự án Xcode của bạn sử dụng lệnh:

ionic prepare ios 

Nếu vấn đề của bạn là bắt nguồn từ giống như mỏ này sẽ giúp.

+2

Điều này cũng giải quyết nó cho tôi, nhưng trong Ionic 2 beta 11. – DarkNeuron

+0

cảm ơn rất nhiều .. Nó đang làm việc – CodeWriter

+2

Trong phiên bản mới của Ionic 'ionic cordova chuẩn bị ios' – Chumillas

Các vấn đề liên quan