IBM Worklight - “getSkinName is not defined”

好久不见. 提交于 2019-12-11 18:16:30

问题


I am trying to define a new android.tablet skin. I am testing with a Nexus 7 running KitKat.

I did this:

  1. Added the Skin
  2. updated getSkinName() function
  3. I can see in LogCat the function getSkinName() being called

However, there is a confusing message:

"default" skin will be used, because skin named android.tablet was not found. Add a skin or change android/js/skinLoader.js to return existing skin.

Am I missing something?

04-01 17:03:32.969: D/CordovaNetworkManager(4481): Connection Type: wifi 04-01 17:03:32.969: D/CordovaActivity(4481): onMessage(networkconnection,wifi) 04-01 17:03:32.969: D/CordovaLog(4481): file:///android_asset/www/default/js/skinLoader.js: Line 18 : screen.width 800 04-01 17:03:32.969: I/chromium(4481): [INFO:CONSOLE(18)] " screen.width 800", source: file:///android_asset/www/default/js/skinLoader.js (18) 04-01 17:03:32.969: D/CordovaLog(4481): file:///android_asset/www/default/js/skinLoader.js: Line 23 : returned skinName is android.tablet 04-01 17:03:32.969: I/chromium(4481): [INFO:CONSOLE(23)] " returned skinName is android.tablet", source: file:///android_asset/www/default/js/skinLoader.js (23) 04-01 17:03:32.969: W/WLDroidGap(4481): "default" skin will be used, because skin named android.tablet was not found. Add a skin or change android/js/skinLoader.js to return existing skin. ... ... ... 04-01 17:03:34.779: D/CordovaLog(4481): file:///android_asset/www/default/worklight/cordova.js: Line 1034 : processMessage failed: Error: ReferenceError: getSkinName is not defined


回答1:


Looks like you're right, Worklight Skins fail to load - at least on the first load of the application; if you load it a second time, it does work.


I've opened a defect for this issue.
If you are an IBM business partner or customer, please open a PMR so that once fixed you'll be able to receive this in the form of an iFix release.


Here's what I've done:

  1. Created a new project and application
  2. Added the Android environment
  3. Added an application skin, android.skin, to the Android environment
  4. Added a main.css to my-app\android.skin\css with body {background-color:red}
  5. Changed getSkinName() in my-app\android\js\skinLoader.js' to return "android.skin"
  6. Run As > Run on Worklight Development Server
  7. Run As > Android application

The first load indeed loads the "default" skin instead of "android.skin". The second time I loaded the app (from the device, not by re-installing the app), it did load the "android.skin"...

So anyway, there's a defect. But you can continue developing your application albeit in a somewhat inconvenient way...



来源:https://stackoverflow.com/questions/22797125/ibm-worklight-getskinname-is-not-defined

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!