iOS has a comprehensive collection of tools and frameworks for storing, accessing, and sharing data. Core Data is a full-featured data modeling framework for object-oriented Cocoa Touch applications, while SQLite is perfect for low-level relational database work. Applications can share data using a URL-based system that works across all of iOS. Web apps can persist data in a client-side cache with the HTML5 data storage API. iOS apps even have access to a device’s global data such as contacts in the Address Book, and photos in the Photo Library.
Core Data provides a flexible and powerful data model framework for building well-factored Cocoa applications based on the Model-View-Controller (MVC) pattern. Core Data provides a general-purpose data management solution developed to handle the data model needs of every kind of application, large or small. You can build anything from a contact-management application to a vector-art illustration program on top of it. The sky is the limit.
Core Data lets you quickly define your application’s data model in a graphical way and easily access it from your code. It provides an infrastructure to deal with common functionality such as save, restore, undo and redo, allowing you to get on with the task of building innovation into your application. Because Core Data uses the built-in SQLite data library there is no need to install a separate database system.
Interface Builder, Apple’s graphical user interface editor, provides pre-built Core Data controller objects that eliminate the need for much of the glue code between your application’s user interface and its data model. You don’t have to worry about SQL syntax. You don’t have to maintain logic trees to track user behavior. You don’t have to create a new persistence mechanism. It’s all done for you, when you wire your application’s user interface to its Core Data model.
iOS includes the popular SQLite library, a lightweight yet powerful relational database engine that is easily embedded into an application. Used in countless applications across many platforms, SQLite is considered a de facto industry standard for lightweight embedded SQL database programming. Unlike the object-oriented Core Data framework, SQLite uses a procedural, SQL-focused API to manipulate the data tables directly.
Share Data Among
iOS provides powerful connectivity options for sharing information among the applications installed on a device. Using a URL-based syntax, you can access data from the Web, as well as pass information to other installed applications, such as Mail, iTunes, and YouTube. Your own application can declare a unique URL scheme, allowing any application to collaborate and share data with your app.
Data and media from iPhone are available to your application via safe, easy-to-use APIs. Your application can create new Address Book contacts and get existing contact info. Similarly, your app can load, display, and edit photos from the Photo Library, as well as use the built-in camera to take new photos.
Event Kit allows iOS apps to access event information from a user’s Calendar database. Fetch events based on a date range or a unique identifier, receive notifications when event records change, and allow users to create and edit events for any of their calendars. Changes made to events in a user’s Calendar database with Event Kit are automatically synced with the appropriate calendar, including calendars hosted on CalDAV and Exchange servers.
XML files provide a lightweight structured format that your application can easily read and write. Plus XML files readily fit into the iOS file system. Store your application settings and user preferences in the built-in User Defaults database. This XML-based data store includes a simple API with powerful features, including the ability to serialize and restore complex objects on demand.