Javascript Windows Phone 8.1插件:找不到类
我对以下代码有以下问题: plugin.xmlJavascript Windows Phone 8.1插件:找不到类,javascript,c#,cordova,windows-phone-8.1,cordova-plugins,Javascript,C#,Cordova,Windows Phone 8.1,Cordova Plugins,我对以下代码有以下问题: plugin.xml <?xml version="1.0" encoding="utf-8" ?> <plugin xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android" id="barcodescanner-plugin" version="0
<?xml version="1.0" encoding="utf-8" ?>
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
xmlns:android="http://schemas.android.com/apk/res/android"
id="barcodescanner-plugin"
version="0.0.1">
<name>Barcode Scanner Plugin</name>
<description>Cordova Barcode Scanner Plugin...</description>
<author>XXX</author>
<license>BSD</license>
<config-file target="config.xml" parent="/*">
<feature name="BarcodeScanner">
<param name="wp-package" value="BarcodeScanner"/>
</feature>
</config-file>
<js-module src="www/BarcodeScanner.js" name="BarcodeScanner">
<clobbers target="window.BarcodeScanner" />
</js-module>
<plattform name="wp8">
<config-file target="Properties/WMAppManifest.xml" parent="/Deployment/App/Capabilities">
<Capability Name="pointOfSale"/>
</config-file>
<source-file src="src/wp/BarcodeScanner.cs" />
<framework src="lib/Windows.Devices.PointOfService.winmd" />
<framework src="lib/WPCordovaClassLib.dll" />
</plattform>
</plugin>
index.js
var exec = require('cordova/exec');
var BarcodeScanner = {
result: "No Result available<br />",
Enable: function () {
try {
var that = this;
this.result += "Test 1<br />";
exec(function () { that.result += "Test 2.1"; }, function (error) { that.result += "Test 2.2: " + error; }, "BarcodeScanner", "Enable", []);
this.result += "Test 2<br />";
} catch (e) {
this.result += "Exception occured<br />";
this.result += e.message + "<br />";
}
}
}
module.exports = BarcodeScanner;
using WPCordovaClassLib.Cordova;
using WPCordovaClassLib.Cordova.Commands;
using WPCordovaClassLib.Cordova.JSON;
namespace WPCordovaClassLib.Cordova.Commands
{
public class BarcodeScanner : BaseCommand
{
public void Enable(string options)
{
PluginResult result = new PluginResult(PluginResult.Status.OK, "Test... Test...");
DispatchCommandResult(result);
}
}
}
var i = 0;
function updateOutputText() {
document.getElementById("output").innerHTML = i + ": " + window.BarcodeScanner.result;
i++;
}
window.setInterval(updateOutputText, 1000);
(function () {
"use strict";
document.addEventListener('deviceready', onDeviceReady.bind(this), false);
function onDeviceReady() {
window.BarcodeScanner.result += "Step 1<br />";
// Handle the Cordova pause and resume events
document.addEventListener('pause', onPause.bind(this), false);
document.addEventListener('resume', onResume.bind(this), false);
window.BarcodeScanner.result += "Step 2<br />";
window.BarcodeScanner.Enable();
};
function onPause() {
};
function onResume() {
};
})();
致:
或
它也不打印测试2.2
所以我现在不知道如何调用我的C方法。。。我认为BarcodeScanner是正确的名字,因为XXXBarcodeScanner完全错了,BarcodeScanner.BarcodeScanner似乎也显示了同样的结果。你能告诉我我做错了什么吗?因为现在我真的很无知
问候,,
史蒂文·彼得(Steven Peter)拿到了那件衬衫——我敢肯定 VisualStudio有一个讨厌的习惯,就是把config.xml弄得乱七八糟,尤其是插件。我还发现这个版本是随机更新的 在文本模式下打开config.xml,确保条形码插件引用在那里。如果需要,创建一个空白项目并添加插件,然后检查它们是否相同。我也有版本信息插件,它只是不存在或版本是错误的 还要养成反复检查android、win8等版本号的习惯,因为它有时不会更新
我真的很喜欢VS,但有时它会考验我的耐心。祝你好运 嗨,之前已经尝试过在科尔多瓦使用它,结果也是一样的。。。这是一个只有wp8的项目,所以我不认为这可能是原因,是的,我的配置文件也有同样的问题,但在大多数情况下,它与插件一起部署。。但谢谢你的帮助:)
<config-file target="config.xml" parent="/*">
<feature name="BarcodeScanner">
<param name="wp-package" value="BarcodeScanner"/>
</feature>
</config-file>
exec(function () { that.result += "Test 2.1"; }, function (error) { that.result += "Test 2.2: " + error; }, "BarcodeScanner", "Enable", []);
exec(function () { that.result += "Test 2.1"; }, function (error) { that.result += "Test 2.2: " + error; }, "BarcodeScanner.BarcodeScanner", "Enable", []);
exec(function () { that.result += "Test 2.1"; }, function (error) { that.result += "Test 2.2: " + error; }, "XXXBarcodeScanner", "Enable", []);