0

我正在将 PushPlugin https://github.com/phonegap-build/PushPlugin和 Cordova 2.5 用于 iOS 应用程序。

在我的插件文件夹中,我有这些文件:

  • Appdelegate+notification.h
  • Appdelegate+notification.m
  • PushPlugin.h
  • PushPlugin.m

在 config.xml 我已经包含了这样的插件: <plugin name="PushPlugin" value="PushPlugin" />

我的 www 文件夹中还有 PushNotification.js 并将其包含在 index.html 中。

当我运行应用程序并执行 push.js 文件中的行时:

pushNotification.register(this.tokenHandler,this.errorHandler, {"badge":"true","sound":"true","alert":"true","ecb":app.onNotificationAPN"});

然后我得到这个错误:

Error: Plugin 'PushPlugin' not found, or is not a CDVPlugin. Check your plugin mapping in config.xml

PushPlugin 是否与 Cordova 2.5 兼容?

4

1 回答 1

2

尝试让 pushplugin 工作时,我遇到了同样的问题。我通过将这段代码放在 config.xml 中(不是 www 文件夹中的那个,而是项目文件夹中的那个)来让它工作

<!-- ios -->
<platform name="ios">

    <config-file target="config.xml" parent="/*">
        <feature name="PushPlugin">
            <param name="ios-package" value="PushPlugin"/>
        </feature>
    </config-file>

    <source-file src="src/ios/AppDelegate+notification.m" />
    <source-file src="src/ios/PushPlugin.m" />

    <header-file src="src/ios/AppDelegate+notification.h" />
    <header-file src="src/ios/PushPlugin.h" />

</platform>

如果您从 git 下载示例项目,则会有一个名为 plugin.xml 的文件,其中有一堆需要添加到 xml 中的东西(我认为)。

希望有帮助。

于 2013-09-23T00:28:19.087 回答