1

メインの html ファイルにプロジェクトとは異なる名前を付けたいです。

同じ名前を使用しないと Worklight が再接続しないことがわかりました。iOS で application-descriptor.xml の mainFile タグを変更し、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 によって指定されたファイル名を常に呼び出すとは限りません。

4

2 に答える 2

3

HTML ファイル名を変更する場合は、以下も変更してください。

  1. application folder名前_
  2. application-descriptor.xml 内:

    • idapplication要素の属性
    • mainFile要素値

すべてが互いに一致する必要があります。

必ずネイティブ フォルダーを削除し、プロジェクトを再ビルドしてください。アプリケーションは初回以降も引き続きロードされ、ダイレクト アップデートは引き続き機能します。

于 2013-06-22T01:37:15.883 に答える
1

私が見つけた唯一の解決策は、メイン ファイルにプロジェクト内のアプリケーションと同じ名前を付けることです。これを行うと、アプリケーションは正常に動作します。

[これは、上記の @Idan Adar の推奨に合わせて編集されていることに注意してください。mainFile と一致する必要があるのは PROJECT ではなく、APPLICATION 名です]

以下はうまくいきます:

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)

wlMainFile で指定されたファイルを初めて使用すると、Worklight は iOS アプリケーションを適切に起動するようです。その後、再開または再起動する必要がある場合、wlMainFile で指定された値ではなく、アプリケーション名を探します。

于 2013-06-21T22:04:12.373 に答える