2014-05-23 27 views
1

我創建使用離子演示應用程序與工作燈和它的工作對的Android遇到錯誤IOS ,當我用手機瀏覽器模擬器和調試在IOS環境中,我得到了如下因素的錯誤消息:IBM工作燈V6.1.0.1:錯誤使用離子與框架時,工作燈和iOS環境中運行

Uncaught InvalidCharacterError: Failed to execute 'add' on 'DOMTokenList': The token provided ('platform-ios - iphone') contains HTML space characters, which are not valid in tokens.

我剛剛加入的index.html文件離子:

<!DOCTYPE HTML> 
<html> 
     <head> 
      <meta charset="UTF-8"> 
      <title>index</title> 
      <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0"> 
      <link rel="shortcut icon" href="images/favicon.png"> 
      <link rel="apple-touch-icon" href="images/apple-touch-icon.png"> 
      <link rel="stylesheet" href="css/main.css"> 
      <link rel="stylesheet" href="ionic/css/ionic.css"> 
      <script src="ionic/js/ionic.bundle.js"></script> 
     </head> 
     <body style="display: none;"> 
      <!--application UI goes here--> 
      <div class="bar bar-header bar-positive"> 
       <h1 class="title">bar-positive</h1> 
      </div> 
      <script src="js/initOptions.js"></script> 
      <script src="js/main.js"></script> 
      <script src="js/messages.js"></script> 
     </body> 
</html> 

我也在移動設備上測試了Android和IOS,並且只在IOS設備上出錯。

我不知道如何解決這個問題。誰能幫忙?謝謝。

+0

您至少需要提供顯示這個問題的測試用例項目.. –

+0

對不起,我編輯了我的問題... – NickNguyen

回答

1

更新5月28日:這裏是一個博客張貼有關工作燈和離子採用了全樣本項目:http://mobileroly.blogspot.co.il/2014/04/using-angular-js-and-ionic-on-ibm.html


嗯,這似乎是離子型框架和工作燈之間的一些不兼容。
工作燈不正式支持離子。

MBS發送「ios-iphone」。
離子反過來不喜歡,因爲有空格...

我不完全知道什麼離子期望有那裏,但你可以通過在ionic.bundle.js中找到此代碼來克服錯誤文件:

for(var i = 0; i < ionic.Platform.platforms.length; i++) { 
    document.body.classList.add('platform-' + ionic.Platform.platforms[i]); 
} 

並將其替換爲以下內容。
錯誤將消失。

for(var i = 0; i < ionic.Platform.platforms.length; i++) { 
    if (ionic.Platform.platforms[i] = "ios - iphone") { 
     document.body.classList.add('platform-ios'); 
     // or maybe 'platform-ready', I don't know... 
    } else { 
     document.body.classList.add('platform-' + ionic.Platform.platforms[i]); 
    } 
} 

然而,這並不在MBS顯示應用程序幫助...
但至少可以再在Xcode的iOS模擬器上運行,以查看應用程序。

似乎離子和Worklight的iPhone/iPad環境不能很好地一起玩。

的index.html:

<head> 
    ... 
    ... 
    <link href="ionic/ionic.css" rel="stylesheet"> 
    <script src="ionic/ionic.bundle.js"></script> 
</head> 

<body ng-app="ionicApp"> 
    <div class="bar bar-header bar-positive"> 
     <h1 class="title">bar-positive</h1> 
    </div> 
    <div style="margin-top:38px"> 
     <p>test test test</p> 
    </div> 
    ... 
    ... 
</body> 

main.js:

angular.module('ionicApp', ['ionic']); 

enter image description here