In some cases, there is no need to use Objective C and special licenses to develop web applications for iPhone. All you need is your knowledge of html and js.
Of course, you can just create a web site and adapt it for iPhone. But we want to add some more information about it.
First, with the advent of html 5 we all get the chance to work with local databases. Moreover, all the browsers based on the WebKit engine (we mean the last updates, of course) support this feature now. It’s so easy to work with them:
db = openDatabase ("YourDemoDB", "2.0", "HTML5 DemoDB", 134000);
The function of database creation refers to the following parameters:
- name of the database;
- its version;
- display name;
- size in bytes.
Then open the transaction and perform the needed actions:
db.transaction (function (tx) ( tx.executeSql ("DELETE FROM tbl_test WHERE id =?", [item.id]); ));
Secondly, it is worth saying about the possibilities of off-line work with creation of a manifest-file. More information about it can be found on the Apple website.
So, manifest is an ordinary file, such as css or js, for example, that contains information about cache of your application. When you enter the page for the first time all the data, indicated in this file will be cached.
Now let’s see what it looks like in practice:
1. Indicate a link to some file on our page
2. Create the file
CACHE MANIFEST demoimages/image_1.jpg demoimages/image_2.jpg demoimages/icon.jpg
And that is all! It works. You have developed web application for iPhone and can work fully with your cache: update it, handle events, and so on.