It seems there are four possible options:
- Web Database
- Key-value storage
- Cookies
- Use a JavaScript to Cocoa bridge to access native persistence
I've given a little thought to the advantages and disadvantages of each (enough to decide to give HTML 5 Web storage a try.) I'll update this document if I get any good feedback.
Web Database
Web Database
Advantages
- Can be used in hybrid, online and offline webapps.
- Supported in iPhone OS 2.0 and later.
- SQL is familiar and powerful for those who know it and need it.
Disadvantages
- Use of SQL is overkill for simple persistence
Key-value Storage
Advantages
- Simple conceptual model than SQL
- Has both "session"and "local" modes
Disadvantages
- Only supported in iPhone 3.0 and later (although Apple isn't very clear on this)
Cookies
Advantages
- Tried and true web technology
Disadvantages
- Either not supported in Hybrid mode or requires extra Cocoa code to support. (Does anybody have a definitive answer, details, or an example?)
- Extra data is transmitted to the server on each request
- Others?
Custom JavaScript to Cocoa Bridge Option
Advantages
- You can use any iPhone native mechanism for persistence
Disadvantages
- Requires custom Cocoa code
- JavaScript to Cocoa bridge options are fairly clunky
- Will not work for pure online/offline webapp