3

I upgraded phonegap to 2.0 (Cordova-2.0.0) a couple of days ago. I used the following instructions to add the ChildBrowser plugin to cordova: https://github.com/alunny/ChildBrowser/blob/master/README.md (used pluginstall and npm to run automated script to set up native portion of the code) as per: https://github.com/alunny/pluginstall

However, it appears that the automated script assumes older PhoneGap code instead of Cordova, so I had to make changes inside .m and .h files of ChildBrowser plugin to use CDV* classes instead of PG* classes. In addition, the script messed up my xcode project, and luckily I had a backup.

All this begs a question -- is there any documentation on how to make ChildBrowser plugin work on Cordova 2.0.0? I see a lot of people complained about Cordova 1.9.0.

ᴠɪɴᴄᴇɴᴛ
  • 1,613
  • 2
  • 21
  • 28

4 Answers4

3

I almost have it working, but it's still not opening for me. But it seems to work for this guy here on google groups.

Remove any #ifdef CORDOVA_FRAMEWORK statement, this is not needed anymore according to the Phonegap docs. So for example in your ChildBrowserCommand.h file change this:

#ifdef CORDOVA_FRAMEWORK
#import <CORDOVA/CDVPlugin.h>
#else
#import "CORDOVA/CDVPlugin.h"
#endif
#import "ChildBrowserViewController.h"

to just:

#import <CORDOVA/CDVPlugin.h>
#import "ChildBrowserViewController.h"

and this:

#ifdef CORDOVA_FRAMEWORK
    @interface ChildBrowserCommand : CDVPlugin <ChildBrowserDelegate>  {
#endif
    ChildBrowserViewController* childBrowser;
}

into:

@interface ChildBrowserCommand : CDVPlugin <ChildBrowserDelegate>  {
  ChildBrowserViewController* childBrowser;
}

You may want to check this out too. Let me know if this worked for you or if you find a solution that works so I can try too.

dda
  • 6,030
  • 2
  • 25
  • 34
  • @dda, tried both plugin upgrade guide and solution above, the project builds, but does not run. I am doing the following in js: window.ChildBrowser.showWebPage(url); – Dmitry Kashlev Jul 25 '12 at 19:05
1

Managed to get this working. Make sure that you use the ChildBrowser code from the iOS branch in the phonegap GitHub repository and NOT from the iPhone folder.

Ranhiru Jude Cooray
  • 19,542
  • 20
  • 83
  • 128
  • I can't believe that I spend two hours on this because I installed it from the wrong folder. Thanks for this tips! It solved it for me. How unclear... – Anthony Jan 06 '13 at 11:57
1

All explained here works like charm : http://blog.digitalbackcountry.com/2012/03/installing-the-childbrowser-plugin-for-ios-with-phonegapcordova-1-5/

For Cordova 2.3.0 you should modify config.xml because cordova.plist does no longer exist. Like:

<plugins>
    <plugin name="ChildBrowser" value="ChildBrowser.js" />
    <plugin name="ChildBrowserCommand" value="ChildBrowserCommand" />
   …
</plugins>
miguel
  • 13
  • 3
0

Guys i am sorry i cannot make a full tutorial or blog post, but i know the next best thing

Checkout this github repo, you will find the steps to reach your goal and a working project, i did this just to help you guys, but note i am also a noob i just started using phonegap so if you have any comments or suggestions please pullrequest or comment

P.S. the first commit titles Initial Commit is just the default PhoneGap template, no need to look there, look onto each commit after that.

thanks

Shereef Marzouk
  • 3,282
  • 7
  • 41
  • 64