0

I'm developing an app for iPhone using Xcode and PhoneGap and HTML, and ChildBrowser. I'm trying to display a PDF that is being retrieved from Dropbox (the site has been added to the External Array list in Cordova.plist) but the error Plugin 'ChildBrowserCommand' not found, or is not a CDVPlugin. Check your plugin mapping in Cordova.plist comes up in the console and i don't understand what's wrong. in Cordova.plist, i added to the Plugin Dictionary;

enter image description here

The JavaScript is;

childbrowser = ChildBrowser.install();

function viewOnline(site) {
  cordova.exec("ChildBrowserCommand.showWebPage", encodeURI(site));
}

and the HTML is;

<button onclick="viewOnline('http://dl.dropbox.com/u/97184921/Internship%20Stuff/Holidays.pdf');">View Online</button></li>

I'm fairly new to ChildBrowser and don't really understand what's wrong; how do i fix the code?

EDIT

this is the full error that comes up in the console if it helps;

2013-03-11 16:05:00.327 TestApp1[62039:15b03] ERROR: Plugin 'ChildBrowser' not found, or is not a CDVPlugin. Check your plugin mapping in Cordova.plist.

2013-03-11 16:05:00.328 TestApp1[62039:15b03] -[CDVCommandQueue executePending] [Line 102] FAILED pluginJSON = [null,"ChildBrowser","showWebPage",["http://dl.dropbox.com/u/97184921/Internship%2520Stuff/Holidays.pdf"]]

Megan Sime
  • 1,257
  • 2
  • 16
  • 25

2 Answers2

0

Remove the .js from your plist and remove the Command from your javascript call.

Rob
  • 4,927
  • 12
  • 49
  • 54
  • Well im sure you don't have to add the `.js` to your plist :P. Not saying this is the only issue you're having tho. :P – Rob Mar 11 '13 at 15:33
  • also change this: `cordova.exec('ChildBrowser.showWebPage', encodeURI(site));` (remove the `Command`) – Rob Mar 11 '13 at 15:37
  • ...at the risk of sounding like an idiot, the command is the `encodeURI` thing right? – Megan Sime Mar 11 '13 at 15:44
  • No, `cordova.exec` requires 2 parameters. The first one is a string: Plugin.action, which in your case is the `Childbrowser` plugin and the `showWebPage` action (try looking at the native source to understand how it works. The second param is just a object to pass to the native action. Which should be te actual url to go to. `encodeURI` is a javascript method to encode your string to be a valid URL. – Rob Mar 11 '13 at 15:47
  • ok, so would i change it to be just `'ChildBrowser.showWebPage', encodeURI(site);` or would i change it to a different thing? sorry about all the questions i'm running on two hours sleep and nothing's processing properly -_- – Megan Sime Mar 11 '13 at 15:52
  • No problem man, i'm here to help :P change the line to this: `cordova.exec("ChildBrowser.showWebPage", encodeURI(site));` – Rob Mar 11 '13 at 15:54
  • it still won't work, it keeps saying the plugin doesn't exist – Megan Sime Mar 11 '13 at 15:57
  • Alright, im gonna help you.. But i got to go, i'll get back in about 45 minutes if thats not a problem.. – Rob Mar 11 '13 at 16:00
  • no not at all, i'll edit the question to include more code i think might help – Megan Sime Mar 11 '13 at 16:01
0

I answered it myself - you need to make sure all ChildBrowser files are in the Plugins folder in Xcode (can be seen to the left of the screen underneath the index.html files etc - may be empty at first

Megan Sime
  • 1,257
  • 2
  • 16
  • 25