December 30, 2008
A Quick Reference for how to create QuickConnectiPhone applications
This posting is also available as a page on the QuickConnect wiki
Because QuickConnectiPhone, like the other members of the QuickConnectFamily, is an application framework much of what you would normally need to do to create and application is already done for you. It is modular in nature and handles all of the communication between the modules. You create your functionality as discrete mini-modules that either interact with, get, or set data, display information, or do validation of data. These mini-modules are then called by the framework in the order that you state in response to ahandleRequest function call. Below are the three steps followed when adding or creating functionality for your application. These steps are the same for all members of the QuickConnectFamily of frameworks. Follow these steps.
- Call the handleRequest function as the result of an event. You can either make the linkage between the event directly or from within an event handler that Dashcode creates for you. There are two parameters for the handleRequest function.
- aCmd – a string that is a command indicator. These should be unique to the functionality you desire to be executed.
- paramArray – an array of parameters that you want to be available later in the code that will handle the request. These could be, but are not limited to, the object triggering the event, an event object, or anything else you may need.
- An example of calling this function would be handleRequest(‘userData’) which could cause data to be retrieved and displayed.
- Create one or more mappings of the command to specific functions you want called every time handleRequest is passed the command. These mapping calls are made in the mappings.js file included in the framework. There is a different mapping function for each type of mini-module. All of these mapping functions have two parameters.
- aCmd – a string that is the command the mini-module is to be mapped to. This corresponds with the aCmd parameter ofhandleRequest.
- aControlFunction – a mini-module of the correct type, see below, that the framework is to call when the command is passed to handleRequest.
- mapCommandToBCF – maps your command to a mini-module that will get, set, or manipulate data called a Business Control Function (BCF). You can have any number of these mappings in a row for a command. The framework calls them in the order that you put them in the file.
- mapCommandToVCF – maps your command to a min-module that displays data or modifies the user interface in some way called a View Control Function (VCF). You can have any number of these mappings in a row for a command. The framework calls them in the order that you put them in the file.
- mapCommandToValCF – maps your command to a mini-module that you use to validate the parameters passed to the handleRequest function called a Validation Control Function (ValCF). You can have any number of these mappings in a row for a command. The framework calls them in the order that you put them in the file. an example of a ValCF would be one for a login command that validated the user name and password included in the paramArray of thehandleRequest function.
- mapCommandToECF – maps your command to a mini-module used to handle errors called an Error Control Function (ECF).You can have any number of these mappings in a row for a command. The framework calls them in the order that you put them in the file. To follow the login command example used in #3, if the user name or password failed validation for some reason any ECF’s that you map to the login command will be called by the framework on validation failure. You could then display some helpful message for the user.
- Create the mini-modules to be called as listed in the mappings for the command. These are implemented in the functions.js file as standard JavaScript functions. There is a suggested naming convention. The name should end with the shorthand for the type of mini-module it is. For example, a Business Control Function doing a login check would be called loginBCF. Each one of these functions should do one thing. Remember that you can have any number of them and the framework will call them for you in the sequence you defined the mappings in the mappings.js file. BCF’s and ValCF’s are always created with one parameter. The framework uses this parameter to pass your BCF the parameters array you created and passed to the handleRequest function. VCF’s are always created with two parameters. The first will be the data accumulated by the calls to your BCF’s and the second is the same parameters array that was passed to your BCF’s and ValCF’s. ECF’s also have one parameter. It is a descriptor string for the error. You con choose to use it in your control function or not. Examples of these types of control functions are available in the Examples directory of the download.
kinoli said,
January 28, 2009 at 12:38 am
Hi, is this framework only for iphone web apps or actual inline applications?
tetontech said,
January 28, 2009 at 3:57 pm
This framework is for installable applications not web apps. QCiPhone and now QCAndroid allow you to write your installable, non-web app, application in HTML, CSS, and JavaScript. No internet connection is required by the framework nor your completed application.
Kinoli said,
January 28, 2009 at 6:06 pm
That is great. Am I correct in assuming that the interface builder won’t work with this framework? It looks like you have to use dashcode for that, is that correct? Is this framework more setup for web developers familiar with javascript so they don’t have to learn objective-c?
Thanks a lot.
tetontech said,
January 28, 2009 at 7:26 pm
You could use the underlying Objective-C portion of the framework with interface builder. You could also use interface builder to create additional UIViews that would work with the framework in addition to the UIWebView that is already included. You could even embed the framework in a mainly Objective-C application and use it for displaying specific user interface elements. It’s up to you to decide how to use it.
As the Xcode template provided in the framework stands, it creates an installable application where the user can write the UI and the logic of the application in HTML, CSS, and JavaScript and still activate device behaviors usually only accessible to the programmer via Objective-C.
This means that you can, should you choose, write your application in Dashcode and then move the result into an Xcode project created using the template. It also means that you don’t have to know Objective-C to create an iPhone application.
QuickConnect iPhone: an iPhone UIWebView hybrid framework « Teton Technical said,
May 27, 2009 at 4:30 pm
[…] To see the new functionality that is in the current shipping versions look here. For a QuickStart on how to use QuickConnect look […]