Phonegap 3.3.0: Unable to locate command :: LocalN

2019-09-15 00:18发布

Background: I add the Windows Phone 8 Version of Katzer's LocalNotifications Plugin into asiFarran's LocalNotifications Plugin. After I changed config_munge in plugins/wp8.json from ' :0' to :1 I am not getting Plugin not allowed in config.xml anymore and log shows Adding feature.value=LocalNotification but now:

Question: Log shows Unable to locate command :: LocalNotification.

I tracked this down to CommandFactory.cs line 94.

My plugin.xml contains for wp8:

<platform name="wp8">
    <config-file target="config.xml" parent="/*">
        <feature name="LocalNotification">
            <param name="wp-package" value="LocalNotification"/>
        </feature>
    </config-file>

    <source-file src="src/wp8/LocalNotification.cs" />
    <source-file src="src/wp8/Options.cs" />
</platform>

And plugin is added in config.xml:

<gap:plugin name="com.stratogos.cordova.localNotifications" version="0.1.0" />

Files get copied into platform/wp8. I removed and recreated the wp8 platform but that did not fix it.

If I set the namespace in call method I am back to: Plugin not allowed in config.xml.

In JavaScript I am calling

exec(null,null,"LocalNotification","addNotification",[defaults]);

The plugin has src/wp8/LocalNotification.cs with:

namespace Cordova.Extension.Commands
{
    public class LocalNotification : BaseCommand
    {
        public void addNotification(string jsonArgs)
        {
...

According to the documentation the Class name must match with what I am calling in exec(). So my mistake must be somewhere else I think.

Update

I could not find the LocalNotification.cs in the wp8 project. How and where is this plugin file supposed to be added?

1条回答
再贱就再见
2楼-- · 2019-09-15 00:27

I solved this issue by manually adding the wp8 source files from plugins/YOURPLUGIN/src/wp8/* into the project. If you open it in Visual Studio you can drag and drop the file into a folder. I dragged it into /cordovalib but an extra folder for plugins would be nicer.

查看更多
登录 后发表回答