簡體   English   中英

Cordova 3.3中Windows Phone 8的LiveTile插件

[英]LiveTile plugin for Windows Phone 8 in Cordova 3.3

我試圖將LiveTile插件(在此處找到)添加到干凈的Cordova 3.3項目中。 但是我似乎無法使其正常工作。 它可以使用鏈接中的指令,但使用的是Cordova 2.0.0。 嘗試添加新的圖塊時,得到以下打印輸出:

        An exception of type 'System.InvalidCastException' occurred in System.ServiceModel.Web.ni.dll and wasn't handled before a managed/native boundary
        A first chance exception of type 'System.InvalidCastException' occurred in System.ServiceModel.Web.ni.dll
        An exception of type 'System.InvalidCastException' occurred in System.ServiceModel.Web.ni.dll and wasn't handled before a managed/native boundary
        Unable to cast object of type 'System.Collections.Generic.List`1[System.Object]' to type 'System.Collections.Generic.Dictionary`2[System.String,System.Object]'.
        Failed to deserialize Cordova.Extension.Commands.LiveTiles+LiveTilesOptions with JSON value :: ["System.Collections.Generic.Dictionary`2[System.String,System.Object]","LiveTiles963855178"]
        A first chance exception of type 'System.NullReferenceException' occurred in CordovaWP8_2.9.14.DLL
        An exception of type 'System.NullReferenceException' occurred in CordovaWP8_2.9.14.DLL but was not handled in user code
        A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.ni.dll
        An exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.ni.dll and wasn't handled before a managed/native boundary
        ERROR: Exception in ProcessCommand :: Exception has been thrown by the target of an invocation.
        ERROR: failed to InvokeMethodNamed :: createSecondaryTile on Object :: LiveTiles
        The thread 0xbac has exited with code 259 (0x103).
        Error occurred: Invalid action

插件是否與此新版本的Cordova有所不同,還是LiveTile插件不再兼容?

這可能是一個愚蠢的問題,但是由於文檔如此貧乏,因此很難將任何問題稱為愚蠢的問題。 但是,我現在設法解決了這個問題,並且在其他人遇到相同問題的可能性很小的情況下,我將嘗試解釋我的所作所為。

首先,我發現了LiveTiles插件的這種實現, 實現似乎比問題中的最新。 我沒有使用Visual Studio創建新項目,而是使用CLI。

phonegap create hello com.example.hello HelloWorld

然后,我根據上面的鏈接使用了plugman來安裝插件。

plugman install --project . --platform wp8 --plugin com.risingj.cordova.livetiles

現在,我查看了文件以查看發生了什么。

config.xml-一些補充

    <?xml version='1.0' encoding='utf-8'?>
    <widget>
        <access origin="*" />
        <feature name="LiveTiles">
            <param name="wp-package" value="LiveTiles" />
        </feature>
    </widget>

在www文件夾中生成了一個新文件: cordova_plugins.js ,其內容如下:

cordova.define('cordova/plugin_list', function(require, exports, module) {
module.exports = [
    {
        "file": "plugins/livetiles.js",
        "id": "com.risingj.cordova.livetiles.livetiles",
        "clobbers": [
            "LiveTiles"
        ]
    }
];
module.exports.metadata = 
// TOP OF METADATA
{
    "com.risingj.cordova.livetiles": "0.1.0"
}
// BOTTOM OF METADATA
});

我將這些文件添加到Cordova Visual Studio項目中,並且可以正常工作! 因此,我猜是否需要添加新插件。

您需要這樣做:

cordova plugin add path/to/your/plugin

它將完成所有工作。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM