Skip to Navigation | Skip to Content



Introducing iPhone Cleavage | April 20th, 2010

So if you want to make an iPhone app using your HTML/CSS/JavaScript skills, what do you use? PhoneGap! obviously.

If you want to add some iPhone native controls, screens, whatever… PhoneGap Plug-ins seem like a fairly easy path, even though they are still largely undocumented, and unknown to most, at least they are somewhat planned.

But what if you have a native iPhone app already, and you want to quickly throw in some phonegap. Before today, there was no easy way to do this because phonegap for iPhone was architected to be the one and only Application delegate. This is the newest use case I have chosen to address.

This approach of breaking PhoneGap functionality into it’s own control space makes some exciting new things possible in the near future. Including:

  • Multiple page / view apps where the views are persistent ( instead of having to reload or navigate between pages )
  • Sandboxed child apps
  • The ability to divide work among multiple developers, without having to constantly keep track of other’s changes.
  • Better division of responsibility within code modules ( divide and conquer methodologies ).
  • Drop-in functionality, for code libraries, add them to your app more easily, and build up your control library over time.

Introducing Cleavage for iPhone.

First off, you may be wondering about the name. I wanted to stick with the ‘gap’ theme so I started brainstorming on other types of gaps.

At first I considered Diastema as it has a nice ring to it. After thinking on that for awhile I decided it would be best not to alienate phonegap developers as we are predominantly Madonna, Letterman, and Mad Magazine fans. ( What, me worry?)

Other Gaps I considered were :

  • Rift - too sci-fi
  • Gape - um, too close to Gap
  • Fissure - too literal, and weird …
  • cavity, chasm, crack, … - just not it

So cleavage it is! .. and given it’s current state it is very much as Jerry Seinfeld says.

“Looking at cleavage is like looking at the sun. You can’t stare at it long, it’s too risky. You get a sense of it then you look away.”

Please keep in mind that this is very much a work in progress, but expect some updates in the near future.

I have posted the PhoneGap control sample app to: http://github.com/purplecabbage/cleavage

Documentation and such to follow later in the week, I hope, here is a quick getting started description.

In order to use this in your own ( pre-existing ) iPhone OS project, you will need to:

  1. add all PhoneGap required frameworks to your project ( the sample project has them all )
  2. add a reference to PhoneGapLib ( you will need the latest checked in version )
  3. place your html/js/css in a www folder in the project and be sure it is packaged in the root of your app when built
  4. include phonegap.js from PhoneGapLib, as it is not auto-copied over for you like it is in a typical phonegap iPhone app.
  5. set linker flags for -all_load and -ObjC

Posted in Uncategorized | 6 Comments » | Add to Delicious | Digg It

This entry was posted on Tuesday, April 20th, 2010 at 9:52 pm and is filed under Uncategorized. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

6 Responses to “Introducing iPhone Cleavage”

  1. Chris Says:

    This is very very interesting and seems a logical next step in making PhoneGap suitable for a broader set of use cases. However I am a little concerned that there have been no further comments here nor commits to github since 4/22. Did Cleavage get shelved? Any comments or guidance you can provide are much appreciated. Thank you.

  2. Chris Says:

    Hi, I am very interested in making use of this facility to combine a native ObjC XCode project with PhoneGap… but there’s been no followup here. If this Cleavage project is really dead could you post to that effect? Otherwise, any chance of documentation? Thanks much.

  3. Jesse Says:

    Hi Chris
    This approach is not dead, just no one at Nitobi has had a chance to work with it. Primarily we do client development, so that is our priority. When there is a lull in client dev work I will definitely continue to build on this approach.
    In the mean time, go ahead and use it, send your feedback, and if you want, fork it and send me a pull request.
    Cheers!

  4. bluelobe Says:

    I’m afraid the sample app at https://github.com/purplecabbage/cleavage has an error. You must not declare the ff:

    #import “UIControls.h”

    When I commented it out, it compiled fine

  5. Bernat Says:

    Hi there,
    Do you know if something similar can be done in Android? I see in Android that the main App extends a DroidGap class and in that class the method loadUrl is called to run the web window. I was wondering if there could be a way to embed that in an Android view and allow the use of other Android windows in a native app.

  6. Bruce Hill Says:

    Hi,

    I have downloaded the sample application and have successfully run it on my iPhone. However, when I try and access the PhoneGap Camera API, the camera is not being displayed. To test this I changed the index.html in www to the full sample given here:

    http://docs.phonegap.com/phonegap_camera_camera.md.html

    From the debugging I have been able to do, it seems that getPicture:withDict: encounters a problem on this line:

    [[super appViewController] presentModalViewController:pickerController animated:YES];

    Anyone managed to get this working with the camera API and know a workaround for this problem?

    Thanks,

    Bruce

Leave a Reply