我正在使用 PushPlugin https://github.com/phonegap-build/PushPlugin和用于 iOS 应用程序的 Cordova 2.5。
在我的插件文件夹中,我有这些文件:
- 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 兼容?
最佳答案
我在尝试让 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 中的内容(我认为)。
希望对您有所帮助。
关于ios - "PushPlugin not found"在 iOS 上使用 Cordova 2.5,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16564930/