「...になる機能はありますか」という限り、私はそれに出くわしていません。
私がしたことは次のとおりです
plist にはウィジェットのバージョンがあり、そこに番号を入力します。たとえば、1.0 とします。アクセスして使用できる必要があります。(コードを参照)理由により、このグローバル var widget_version = "1.4"; を追加しませんでした。ウィジェットが更新されたときにそれを更新しました。
次に、Web からアクセスできるサーバーで、ウィジェットの現在のバージョン番号を含む php (または何でも) ファイルを作成します。もう一度 1.1 としましょう。
次に、この現在のウィジェットのバージョンをサーバーのバージョンと照合し、グラフィックまたはメッセージを表示してユーザーに通知する JavaScript 関数を記述します。アップグレードを自動的に行うよりも、ユーザーがアップグレードするかどうかを決定できるようにすることをお勧めします。
以下は私が使用したコードです。好きなようにコピーまたはハッキングしてください。
function getSoftwareUpdate() {
// so use the built in CURL to do a REST call n.b. in widget preference you will need to check 'allow network access'
var softwareUpdate = widget.system("/usr/bin/curl 'http://api.yourserver.com/widget/wfccupdate.php'", null).outputString;
//alert(softwareUpdate); // tells you the function has been called
//alert("the update number from the REST " + softwareUpdate); // for debugging will show the key
// in main.js add this line
// var widget_version = "1.4"; // this is changed when you update the widget code for new release
// yes it's a global variable and bad but i was in a hurry
// the following line should get the widget number but for some reason i didn't do it
// localVersion = widget.preferenceForKey(preferenceForKey);
//alert("the internal preference key " + widget_version);
// then check to see if they match
if(softwareUpdate == widget_version)
{ hide_update('softwareupdate')
}
else
{show_update('softwareupdate')
}
}
function hide_update(el) { // hide the update graphic
if(document.getElementById(el))
{
if(document.getElementById(el).style.display != "none")
document.getElementById(el).style.display = "none";
}
}
function show_update(el) { // show the update graphic
if(document.getElementById(el)) {
if(document.getElementById(el).style.display == "none")
document.getElementById(el).style.display = "block";
}
}
// this is the php that is called by curl and acts as REST
<?php
// data
$UPDATE_database = <<<_UPDATE_
<?xml version="1.0" encoding="utf-8" ?>
<update>
<widgetversion>1.1</widgetversion>
</update>
_UPDATE_;
// load data
$xml = simplexml_load_string($UPDATE_database);
$result = $xml->xpath("widgetversion");
print $result[0];
?>
お役に立てれば