My experience over the last few years has been that of connecting to one or other of the databases web developers are accustomed to connecting to. So MySQL PostgreSQL, Redis, Mongo etc.
In the early days access was by a connection and then writing sql code to extract the data and so forth. Latterly it has been in an OO method using an ORM or at least some form of library and abstraction layer. Simpler and more efficient, or slower and more complex depending on your point of view.
However moving to mobile means i need at the very least to rethink the the process and probably to change my way of thinking and working. The first and most obvious changes are connectivity and storage.
Connectivity & Storage
Unlike the web applications a mobile device has limited connectivity & in some case more expensive connectivity and has limited storage. It may seem blindingly obvious but there are two way iOS devices connect
Unless someone has an unlimited data plan then cellular connection for data can be expensive, use up the subscribers allowance and also be quite slow, especially at crucial times or when connections are poor etc. WIFI is often free, in the home, in Starbucks, a good tip if you really want a fast connection is to use an Apple store. But sometimes people pay for wifi, on trains, most hotels these days so again an eye needs to be kept on how much is downloaded and when.
general size of iOS applications and Apple restriction
This is not a detailed explanation of these types of storage. For that you need to look further doing your own research
- Plist — Apples native property lists. Essentially xml files but optimised for O SX and iOS. Extensively used and for smaller amounts of data very efficient. Apart from anything else as they are so embedded in Apple programming culkture they are solid and reliable and well known. So a question in an Apple Forum or at Stack Overflow will almost certainly be answered. - See more at Apple
- XML File — Plain XML file. If you are creating it yourself it would be better use a Plist. But it might be something you are extracting from a feed with a rest call
- File — Other than xml you may also be recieving a file back in another format. The most likely being JSON. This is a very popular and lightweight form of data transmission and often used as a replacement for xml. Of course the file could be of any format that you can parse and of your own devising
- SQLite - is an interesting animal and worth you spending some time on reading up — see here — in its own words “SQLite is a software library that implements a self-contained, serverless, zero-configuration, transactional SQL database engine. SQLite is the most widely deployed SQL database engine in the world. The source code for SQLite is in the public domain.” So it’s a single file with the program and the data in it. You plonk it on you iPhone/iPad and access it with SQL commands and that’s it. To back it up make a copy of the file. To give a copy of the data to another device, copy the file. SQLite can be used as any SQL database with standard queries. However it is recomended to use a wrapper such as FMDB to make life a bit easier (see below).
- Core Data — This is not a database or a datastore but as Apple says “The Core Data framework provides generalised and automated solutions to common tasks associated with object life-cycle and object graph management, including persistence.”. So if you have used and ORM in Web programming it is like that. Simplistically it is a wrapper around any datastore you use and allows you to access that datastore with a standard set of commands. If you read more and listed to the tech podcasts you will get varying opinions of CoreData from brilliant to awful. I shall post a separate pice on this range of opinions in the near future.
- iCloud — Again not a datastore or database but Apples way of transfering data in an application between that application on different devices (all Apple devices). e.g. Your calendar on your iPhone. You add all sorts of data to it and then pick up you iPad or go onto your iMac and the data is not there. So you could reenter it all but sounds a bit silly and massively ineffective. However, if you switch iCloud on then via Apples servers (and the American secret service no doubt) your data will be synced between all you devices.
Third Party Libraries
- AFNetworking — (free) a library wrapping Apple foundation classes that just makes life easier. Well supported and a thriving community worth a look here
- FMDB - (free) more focused and is a wrapper round SQLite look here
- Rem Objects - (paid for) well established company (2002) providing a range of products in the mobile space both cross platform and cross language. Their products are all charged for but at the point you need them, and they are not a small developer type product, the cost is insignificant to the money you can no doubt save. here.
There are two types of cloud services. Those like Amazon Web Services — AWS that provide servers and databases (putting it very simply) in the cloud and those that as well as providing servers and databases also provide specific services geared to the mobile market
- Windows Azure - (paid for) cloud services from Microsoft.x here.
- Parse — Will store app data in the cloud, run app code in the cloud and will also manage push notifications. Parse were an independent company bu have recently been acquired by Facebook. Parse not surprisingly offer social integration probably heavily with Facebook but is that is your thing then that is a benefit. Parse offers free plans up to a certain amount of useage after which you start paying. See more here
- Push.io — are similar to Parse but do not have a free entry level plan. More here
- Stackmob — are similar to Parse and Push but do have a free entry level plan. More here