IBM Worklight 5.0.x - 更改主HTML文件名

时间:2013-06-21 22:04:12

标签: ibm-mobilefirst worklight-studio

我希望我的主html文件的名称与我的项目不同。

我发现如果我不使用相同名称,Worklight将不会重新连接。我已经尝试更改application-descriptor.xml中的mainFile标记并更改iOS上的worklight.plist中的wlMainFile条目。

直接更新无效。更重要的是,应用程序没有重新连接,我得到一个灰色屏幕(可能是因为iOS试图使用错误的文件启动)。

例如:

Project name: MyProject
main file: home.html
application-descriptor.xml: <mainFile>home.html</mainFile>
worklight.plist: <wlMainFile>home.html</wlMainFile>

以上不起作用。

[稍后编辑添加我的application-descriptor.xml]

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Licensed Materials - Property of IBM
             5725-G92 (C) Copyright IBM Corp. 2006, 2012. All Rights Reserved.
         US Government Users Restricted Rights - Use, duplication or
         disclosure restricted by GSA ADP Schedule Contract with IBM Corp. -->
<!-- Attribute "id" must be identical to application folder name -->
<application xmlns="http://www.worklight.com/application-descriptor" id="agent" platformVersion="5.0.6">
 <displayName>My app</displayName>
 <description>My application description </description>
 <author>
    <name>Redacted</name>
    <email>redacted@foo.com</email>
    <homepage>http://redacted.com</homepage>
    <copyright>(c) redacted LLC</copyright>
 </author>
<height>748</height>
<width>1024</width>
<mainFile>home.html</mainFile>
<thumbnailImage>common/images/ipad-app-icon.png</thumbnailImage>
<!--  -->
<ipad bundleId="com.redacted.myproject" version="1.0">
    <worklightSettings include="true"/>
    <security>
        <encryptWebResources enabled="false"/>
        <testWebResourcesChecksum enabled="false" ignoreFileExtensions="png, jpg, jpeg, gif, mp4, mp3"/>
    </security>
</ipad>
<!--  -->
<android version="1.0">
    <worklightSettings include="true"/>
    <security>
        <encryptWebResources enabled="false"/>
        <testWebResourcesChecksum enabled="false" ignoreFileExtensions="png, jpg, jpeg, gif, mp4, mp3"/>
        <publicSigningKey>Replace this text with the public key of the certificate with which you sign the APK. 
        For details see the Worklight Developer's Reference Guide.</publicSigningKey>
    </security>
</android>
<worklightServerRootURL>http://${local.IPAddress}:8080</worklightServerRootURL>
</application>

因此,要清楚,如果我遇到一个问题,我的mainFile是项目名称以外的名称。 Worklight并不总是调用mainfile指定的文件名,尤其是在初次使用应用程序之后。

2 个答案:

答案 0 :(得分:3)

如果更改HTML文件名,请务必同时更改:

  1. application folder名称
  2. 在application-descriptor.xml中:

      {li} id元素application元素
    • mainFile元素值
  3. 所有人都应该相互匹配。

    确保删除本机文件夹并重新构建项目。 应用程序将在第一次后继续加载,直接更新将继续运行。

答案 1 :(得分:1)

我找到的唯一解决方案是将主文件命名为与项目中的应用程序相同的名称。我执行此操作时,我的应用程序运行良好。

[请注意,这已经过编辑,以符合@Idan Adar上面的建议。不是PROJECT必须匹配mainFile,而是APPL名称]

以下工作正常:

Project name: MyProject
main file: MyProject.html
application-descriptor.xml: <mainFile>MyProject.html</mainFile>
worklight.plist: <wlMainFile>MyProject.html</wlMainFile> (this is a generated file)

看来Worklight第一次使用wlMainFile中指定的文件正确启动了iOS应用程序。然后当它必须恢复或重新启动时,它正在寻找应用程序名称而不是wlMainFile中指定的值。