0

我試圖將LiveTile插件(找到here)添加到我的Clean Cordova 3.3項目中。但我似乎無法讓它工作。它適用於鏈接的指令,但使用Cordova 2.0.0。 我碰到下面的打印輸出,當我嘗試添加一個新的瓷磚:用於Windows Phone 8的LiveTile插件Cordova 3.3

 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 

與科爾多瓦的這個新版本中添加不同的插件或者是LiveTile插件根本不兼容了?

回答

0

這可能是一個愚蠢的問題,但由於文檔太窮,很難將任何問題稱爲愚蠢的。 但是我現在已經設法解決了這個問題,並且在別人遇到同樣問題的機會下,我會試着解釋我做了什麼。

首先我發現this 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> 

生成一個新文件:cordova_plugins.js與以下內容的WWW文件夾:

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 
}); 

我添加了這些文件到科爾多瓦Visual Studio項目,它的工作!所以我猜如果添加一個新的插件,這是需要的。

0

你需要這樣做:

cordova plugin add path/to/your/plugin 

它會做所有的東西。