smj2393
smj2393

Reputation: 1957

Add a native Plugin to Cordova 2.9.0 xcode

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

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

This is the code on GitHub.

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>

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

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

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?

Thanks

Upvotes: 0

Views: 1006

Answers (1)

DaveAlden
DaveAlden

Reputation: 30356

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.

For example, change:

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

to

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

Upvotes: 3

Related Questions