10.31.09
QuickConnectiPhone 1.6 beta 3 now available
QCiPhone 1.6 beta 3 includes:
- All new Xcode apps created using the 1.6 beta 2 or later Xcode template will auto-update to a new version of QCiPhone when you run the QCFamily installer
- A fix for the permission build error in beta 2
- In application maps. This feature allows you to drop any number of pins as well as show the current location of the device.
- A new object, DBScript, that allows you to do bulk updates to the SQLite database in a transactionally safe fashion (in-browser only for now. Will work for native databases in the next beta.
Examples for both the in-app maps (MapExample) and DBScript (BrowserDBScript) exist in the iPhone Examples directory of the download.
The post just previous to this one shows how to use the DBScript object.
SQLite bulk data update or insert
I just added SQLite bulk updates for in-browser databases (native databases coming soon) to the QuickConnect iPhone framework (1.6 beta 3). I did this by creating and adding to the framework an object called DBScript. It is transactionally safe. If one of your updates in the script fails all changes are rolled back.
It is also easy to use. The code below comes from the databaseDefinition.js file of the new BrowserDBScript dashcode example. In it a link to the database is established using the DataAccessObject. Then the DBScript object is created and a series of SQL statements are added to the script. Lastly, the script is executed. Notice that the script object works for both standard and prepared statements.
If you are using this after a data pull from a network resource or after querying the user for information to insert, make sure you use a prepared statement type call to avoid SQL insertion attacks.
/*
* An example of how to use the DBScript object to populate a database.
* This will be done as a single transaction and is transactionally safe.
* This means that all changes will be rolled back if any
* database error happens.
*/
//create or connect to the in-UIWebView database
var database = new DataAccessObject(“WelcomeExample”, “1.0″, “Welcome example”, 20);
//create the script object
var bulkInsertScript = new DBScript(database);
//add all statements to the script object
bulkInsertScript.addStatement(“CREATE TABLE IF NOT EXISTS names (id INTEGER UNIQUE, name TEXT)”);
bulkInsertScript.addStatement(“INSERT INTO names VALUES(1,’Bob’)”);
bulkInsertScript.addStatement(“INSERT INTO names VALUES(2,’Sue’)”);
//and example of using a prepared statement
bulkInsertScript.addStatement(“INSERT INTO names VALUES(?,?)”,[3,"Jose"]);
bulkInsertScript.addStatement(“INSERT INTO names VALUES(4,’Bjorn’)”);
bulkInsertScript.addStatement(“INSERT INTO names VALUES(5,’Jean’)”);
bulkInsertScript.addStatement(“INSERT INTO names VALUES(6,’Gustav’)”);
//execute all statements within a transaction
bulkInsertScript.executeSetDataScript();
10.25.09
Speaking at iPhone Developers Conference
I am going to be speaking at the upcoming iPhone Developers Conference in Santa Clara on the 3rd of November. I’m going to be speaking on Rapid Prototyping and using QuickConnect.
If you would like to attend the conference, follow these instructions to get in for free.
Snow Leopard QuickConnectiPhone Update
QuickConnect 1.6 beta 2 is now available. It includes the functionality that allows you to create QCiPhone Applications in the version of Dashcode shipping with Snow Leopard. The Objective-C code has also been reorganized. It now is contained in a sub-project to allow you to more easily focus on the JavaScript used to create your application.
I’m going to give a short description of how to create an application and move it into a Dashcode application. I’ll put a tutorial movie on the wiki on Monday Oct. 26th.
Creating a Dashcode Project and Moving it into Xcode
- Copy the QCDashcodeTemplate.dcproj and rename it with the name for your application.
- Design and build all or portions of your application in Dashcode.
- Export your Dashcode project to your Sites directory.
- Create a new Xcode project by selecting the QuickConnect iPhone Application
- Use Finder to copy the files and directories from your exported Dashcode project into the newly created Xcode project directory. Make sure you allow finder to copy over all of the files and directories in the project.
- In Xcode, compile and run your application.
- Expand your application to include access to the native behaviors of the device as needed by using the functions in the com.js file.
If you do not want to use Dashcode to create your application all you need to do is to edit the index.html file and include any JavaScript files you wish to use. You should also delete the Dashcode specific directories from your Xcode project.
By the way, any of the existing JavaScript libraries such as JQuery, etc. should be usable with QC not just Dashcode.
10.06.09
Display Office documents in Hybrid iPhone Applications
I have been playing around with the UIWebView today and found something interesting. The UIWebView can process and display Word, Excel, PowerPoint, PDF, and RTF files. Additionally I understand that the iWork files can also be displayed, though I haven’t tried those yet.
The quick test I created consisted of links in index.html that pointed to each of the Microsoft Office file types as well as PDF and RTF files. I put the files in the Resources group of the Xcode project and all of the files displayed correctly.
If all you want to do is display these files, QCiPhone has complete support. Editing is another question all together. That would require a huge development effort.
09.24.09
QuickConnectiPhone 1.6 Beta 1 is now available
QCiPhone 1.6 beta 1 is now available from the sourceForge repository. It includes access to the Contacts API via JavaScript as well as a new way of doing GPS locations and tracking. There are two new examples to show how to use the new functionality, GPSExample and Contacts Example.
The old in-application map functionality has been commented out in anticipation of Beta 2 which will include the access to the new 3.0 Map API and in-application email.
Push from within JavaScript and receiving pushes in JavaScript planned for Beta 3.
Native JSON Parser in Safari
I just got through running a test and found the Safari has built-in Native JSON parsing and stringifying. Unfortunately Mobile Safari does not yet have this feature. I am hoping to be able to remove the json2.js file from QCMac but am unsure yet as to how the native parsing compares to json2.js parsing.
Hopefully the comparison is good and it will soon be found in Mobile Safari so it will also be included in the UIWebView.
Snow Leopard and Custom Xcode templates
I have been experiencing linking errors when using the custom iPhone Xcode templates developed under Leopard. On further investigation I have found that Xcode 3.2 appears to be interpreting the templates as OS 10.5 templates rather than iPhone templates. This causes linker failures when the 10.5 project attempts to link the iPhone libraries.
I am re-creating the iPhone template for QCiPhone 1.6 Beta 1
09.08.09
QuickConnectiPhone 1.5.1 available and includes installer fixes.
It has come to my attention that the installer in the 1.5.0 release didn’t include the latest Xcode templates for QCiPhone, QCMac, and QCErlang.
The 1.5.1 release, being uploaded now, fixes this problem as well as updating the standard Erlang template to work with Xcode 3.2 that ships with Snow Leopard.
I have also been able to make the download smaller by 50%. That should help with download times.
The drag and drop library has been converted to use translate3d rather than translate as this appears to be a smoother dragging experience for most devices.