将本地插件添加到Cordova 2.9.0 xcode [英] Add a native Plugin to Cordova 2.9.0 xcode

查看:76
本文介绍了将本地插件添加到Cordova 2.9.0 xcode的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目标是要有一个查看PDF"按钮,允许用户在iPad上查看PDF.

Aim is to have a "View PDF" button which allows the user to view the PDF on an iPad.

这是插件我要添加到Cordova(Phonegap).

Here is the plugin I want to add to Cordova (Phonegap).

是GitHub上的代码.

This is the code on GitHub.

到目前为止,我已经更新了html文件以运行脚本并在单击按钮时使用相同的功能(所有这些都在他的示例中的body标签中):

So far I have updated my html file to run the scripts and same function on button click (All this is in the body tag like his example):

<button id="externalPdf" onclick="app.openExternalDoc();">Open pdf</button>
<script type="text/javascript" src="../assets/js/index.js"></script>
<script type="text/javascript" src="../assets/js/ExternalFileUtil.js"></script>
<script type="text/javascript">
    console.log("initialize app");
    app.initialize();
</script>

我已将Index.js和ExternalFileUtil.js复制到项目中.

I have copied the Index.js and ExternalFileUtil.js into the project.

我已将2个Objective-C文件链接到插件文件夹(不确定是否正确)

I have linked the 2 Objective-C file to the plugin folder (Not sure if this is correct)

我已经编辑config.xml文件以运行插件:

And I have edited the config.xml file to run the plugin:

<plugins>
    <plugin name="ExternalFileUtil" value="CDVExternalFileUtil"/>
</plugins>

它似乎还是没有用,有什么主意吗?

It still doesn't seem to work though, any ideas?

谢谢

推荐答案

插件需要更新才能使用

The plugin needs updating to use the new plugin signature in order to use it with the most recent versions of Phonegap. The JS is OK, but the Objective-C needs updating.

例如,更改:

- (void) openWith:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options;

- (void) openWith:(CDVInvokedUrlCommand*)command;

这篇关于将本地插件添加到Cordova 2.9.0 xcode的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆