Get Updates By E-mail 

Subscriber Counter
Article Written By:
Johann Dowa

Access Native Objective-C Code In Javascript Iphone Apps

Yesterday, I told you how to execute Javascript code on a page showing in a UIWebView using Objective-C. That was rather trivial as Apple has messaging functionality built in to allow that. Executing Objective-C code from within a Javascript application is not trivial. I highly suggest using one of the three frameworks I mentioned in a previous post.

Now, this is something that I haven’t coded myself because I haven’t run into a situation where I was using a web app that needed to add functionality not already implemented within Phonegap when working with Iphone web app code. However, the author of QuickConnect has an excellent tutorial on doing this here.

Basically what you do is write to NSLog from your Javascript code, then iterate through that log and extract the commands and variables to be used by your Objective-C code.   Overall, it’s not a very complex process, but a rather tedious one.

Thanks for reading this series about turning Javascript web apps into native ones for the Iphone app store, tommorow I will talk a bit about OpenGL ES.

Submit A Resource

Have you created a useful tutorial, library or tool for iOS development that you would like to get in front of our 300,000+ monthly page views from iOS developers?

You can submit the url here.

The resources we feel will appeal to our readers the most will be posted on the front page.

Comments