October 30, 2008

QuickConnectiPhone 1.0 Available

Posted in iPhone development tagged , , , , , , , , , , , , , , at 6:19 pm by tetontech

Update!  Many new features and examples available.

QuickConnectiPhone version 1.5  and 1.6 beta, a framework for creating installable JavaScript iPhone applications, is now available on sourceForge.

Included in the download are many examples of how to use the framework.  One is a Dashcode project file that implements an application completely in JavaScript.  It includes using the sqlite database as well as AJAX.

The second example is how to interact with the iPhone or iPod Touch.  This is a JavaScript application that can get the GPS information from the device.  It can also get the accelerometer information.  You can also use it to vibrate the phone and play system sounds as well as record and play audio.

One of the limitations of the UIWebView is that the pickers displayed when the user selects pull-downs in HTML.  This same example shows you how to use the more useful native pickers from within JavaScript.

This same example shows you how to write out debugging messages in JavaScript and have them show up in the Xcode console.  This is very handy since alerts are not allowed on the iPhone and alerts are a bad way to debug anyway.

These two examples are actually the examples from the book I have in progress.  More of the examples from the book will be added to create RC2 as well as any fixes that need to be made.  One of the examples included will be how to embed Google maps in your application that looks like the Map iPhone app.

Other examples cover everything from how to consume data feeds to doing enterprise data synchronization between the sqlite database on the device and ANY remote database.

I am currently deciding what the last chapter of my book should be. A rough cut of the first four chapters is available on Amazon.com. The title is:

Developing Hybrid Applications for the iPhone: Using HTML, CSS, and JavaScript to Build Dynamic Apps for the iPhone. It is being published by Pearson.

If you have any ideas for things you would like to see how to do with the iPhone please post them here.

The books current chapters are:

  • Creating iPhone Hybrid Applications Using JavaScript
  1. Developing with Dashcode and Xcode           – using both apps to create a hybrid application
  2. JavaScript Modularity and iPhone Applications – the QC Architecture explained
  3. Database Access and iPhone Applications       – using sqlite
  4. Remote Data and Hybrid iPhone Applications  – using AJAX
  • Section 2: Creating iPhone Application User Interfaces
5.  Creating an iPhone User Interface                     – Apple’s rules and other good ideas

6.  Hybrid Applications, GPS, Acceleration and

Other Native Functions                                  – calling objective-c from JavaScript and the QC Obj-C implementation

7.  Embedding Usable Google Maps                       – how to insert Google maps in your application so they look like the Map application that ships on the device.

8.  ??????

Appendices
A.  An introduction to JSON
B.  Intstalling the QuickConnectiPhone Hybrid Templates
C.  JavaScript Objects
Advertisements

16 Comments »

  1. Mike said,

    Impressive! Bravo! I am very excited to try it out. Now developers have no excuse for not developing for the iPhone. Now the G1 is really going to have to improve to even be compared to the iPhone. Thanks for you hard work in making this advancement.

  2. Anthony said,

    Congrats!!! Is there anyway to use it from a Windows box?

    TIA

  3. Andy Fuchs said,

    If I understood correctly, you can’t distribute these kind of applications through the AppStore, because they contain interpreted code. Isn’t that the case? (Well maybe I’m wrong alltogether, so if anyone could shed some light on it….?)

  4. tetontech said,

    Andy,

    This is a commonly held misconception. The restriction is that applications can only use interpreted languages approved by Apple. The only interpreted language approved is JavaScript.

    This means that you can’t write an application in Ruby, Erlang, PHP, since apple has not approved these languages.

    Another related restriction is that application logic written in interpreted languages can not be downloaded by your application and executed. Nor can your application install another.

    The framework here is written in an approved language, JavaScript.

    None of the application logic is downloaded at runtime. It is all included in the compiled application. The framework installs nothing at runtime.

    It fulfills all of Apple’s requirements and uses the UIWebView that is part of the base SDK. The UIWebView does all of the JavaScript interpretation just as apple planned it.

    In fact it appears that Apple used the UIWebView to create the Map application.

    I hope this helps

  5. […] in this posting is included in the downloadable framework called QuickConnectiPhone. Take a look at this posting to learn more […]

  6. […] in this posting is included in the downloadable framework called QuickConnectiPhone. Take a look at this posting to learn more […]

  7. Andy said,

    Hallo Lee,

    thanks for this clarification.This is in fact very good news!

    If there’s anything we can do to help you further improve the framework, please just post a note.

    best

    andy

  8. tetontech said,

    Thanks Andy.

    I am planning on putting a DeviceAccessObject in version 1.1 of the framework that mirrors the ServerAccessObject and the PhoneDataAccessObject. It would need to make getData and setData calls like the ones in the PhoneDataAccessObject and have an additional ‘activate’ method. The activate method would make the calls that you see in the DeviceCatalog example and the get and setData methods would make calls to the existing underlying Objective-C SQLiteDataAccessObject.

    It has been a lot of fun creating this framework but some external help would sure help.

    Is anyone interested in this?

  9. steve said,

    I kind of new to this. What is the advantages of using QuickConnectiPhone compare to direct sqlite insert/update/delete from javascript?
    could I ship preloaded sqlite database ?

  10. tetontech said,

    Steve,

    Welcome aboard.

    One of the first advantages is that you don’t have to learn how to interact with the SQLite database directly. Another is that the API for interacting with the database is very similar to the API provided for the AJAX wrapper. You don’t have to learn how to use the XMLHttpRequest object either.

    The two objects that you use would be the PhoneDataAccessObject for JavaScript database access, in the browser, and the ServerAccessObject for AJAX calls.

    Soon there will be a DeviceAccessObject to wrap the example code currently used to access the device in the DeviceCatalog example application.

    In order to use a pre-shipped SQLite database you would currently need to do what I stated in my Nov. 3rd posting. When the DeviceAccessObject ships as part of QC it will have a getData and setData method that will allow you to use a pre-shipped database within your JavaScript application.

    Unless someone else adds this, it is an open source project, I will create the DeviceAccessObject right after I finish my book.

    QConnectiPhone also includes the ability to write your entire app in JavaScript including interacting with the device itself. You can see the example application ‘DeviceCatalog’.

  11. Steve said,

    Do you think it is good idea to combine QuickConnectiPhone with iui iphone? If I am not mistaken, QuickConnect does not provide the easy interface like iui.

    another question. If I want to have bottom menu like native app, what is the best way to do it using QuickConnect? or I just create a smaller webscreen with menu in the bottom.

  12. tetontech said,

    Steve,

    As far as I know nothing would stop you from using iui. I’m just not sure what it can buy you.

    If you develop your app in Dashcode using the QuickConnect Dashcode project you can then move it into a QuickConnect Xcode project, compile it, and you are ready to go.

    I know that the code generated by Dashcode is not always the slimmest code, but for ease of app creation I haven’t seen anything easier. Especially if you use the QuickConnect Dashcode project.

    What do you see as the benefits that iui would add?

    To answer your question about a bottom menu, you could modify the loadView method of the QuickConnectViewController to add one and then make the UIWebView shorter.

    Or you could write what you want to have happen in JavaScript and make any calls down to Objective-C that you need using the built in JavaScript – Objective-C bridge.

    It is a little difficult for me to be more specific since I don’t know what you are trying to do.

  13. cjr said,

    Hello,
    How to use multiple DashCode project in one native App? The native app will have a TableView to show list of items. Each item represents a separate web app.

    Will it make sense to make one single html (with html/css/js/images inline) for each app ?

    thanks

  14. steve said,

    Wow, thanks for the fast response. Good question on benefit of iui. I don’t know yet, however one thing that attract me when I saw their digg and music example. Seems like it is ready to use. However, for QuickConnect, I don’t see a variety of example yet. So, it is kind of hard to visualize it right away.

    Anyway, thanks for the answer for bottom menu. I will use youtube app in iPhone since everybody familiar with it. In youtube app, there is bottom menu called “Features”,”Most viewed”, “bookmark”, “search”. So basically, what I am trying to do is.
    — When some one touch “Features”, it will replace the UIWebView with feature.html,
    — When some one touch “MostViewed”, it will replace the UIWebView with mostViewed.html,
    — When some one touch “Bookmark”, it will replace the UIWebView with bookmark.html,

    Thanks again, your answer is very helpful. It give me more info what to look for

  15. tetontech said,

    steve,

    You certainly can create the menu you mention on the Objective-C side and then have the UIWebView load different html files based on which one is selected.

    You could also have the code from each of these html files embedded in separate divs of one html fileand then swap these divs in and out using the CSS animations. All of this would be done in JavaScript.

  16. tetontech said,

    cjr,

    You can certainly do what you are asking about.

    You will have to make sure that you rename the index.html files and any of the JavaScript files generated by Dashcode to avoid any name clashes. File structures are not allowed in an Xcode resources directory.

    Would it be possible to merge the dashcode applications and then build the list of ‘applications’ using the browser and list elements in Dashcode?


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: