2014-05-23 31 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