What is the expected 'platform' for iOS?

Hi ionicers,

I have some question that may be difficult to answer…
There is a product called Worklight. Worklight provides a way to create Hybrid apps which has Cordova at its core. There is also the ability to preview your app.

When previewing the Android environment - all works.
When previewing the iPhone environment, this fails with the error:

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

You can see a related question here: ibm mobilefirst - IBM Worklight v6.1.0.1 : Error when using Ionic Framework with Worklight and run on IOS environment - Stack Overflow

To over come this issue I provided a hack in ionic.bundle.js:

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

Now, this removes the error, but the preview still fails with a blank screen.
So I guess my question is: what is ionic expecting to get as the platform value there? Perhaps there is something else required that prevents the app from working. I couldn’t fully follow it through while debugging in Chrome.


I do believe the answer to your question is


and the proof comes if you run “ionic serve” for your app and see the Inspect Element in Chrome (not the page source), which shows you the following on the body tag -

class=“grade-a platform-ready”

Hope that helped. Cheers!

While class=“platform-ready grade-a” is there, nothing displays still.
Perhaps something else is amiss as well.

Thanks for replying.

The console doesn’t show you an error? Increase the number of things you log to the console and maybe we’ll get a hint about what’s up…