How to Share Data Across iOS Apps - dummies

By Rajiv Ramnath

The Address Book and the Settings database aren’t the only databases that are shareable across apps. iOS provides many options for sharing information among the applications installed on a device. Using Universal Record Locators (URL), your app 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 its own URL scheme, allowing any application to collaborate and share data with your app. The following are descriptions of facilities:

  • iOS apps can gain access to event information from the Calendar database on the device. Your app can fetch events within a date range, be notified when events change, and even directly create, edit, and synch events with a remote calendar. Access to the calendar is provided by the Event Kit framework.

  • The UIActivityViewController class is a built-in view controller. You can use it to provide various built-in, standard services, such as a pasteboard for copying and cutting data from your app and pasting it in another one (and vice versa), for posting to social media sites from within your app, and for sending messages via e-mail and SMS.

  • iOS provides a keychain as one of the facilities it offers. A keychain is an encrypted container that holds things like passwords and other information that needs to be secure on an app. Applications with the same app ID prefix can gain shared access to the elements of the keychain that they’re supposed to jointly create and manage.

  • Apple’s iCloud is a cloud storage service where you (and your app) can store data and automatically have this data synchronized with all your devices. iCloud provides an application programming interface (API).

  • As with other frameworks for mobile devices (such as the Android framework), iOS apps can access the web through web services programming interfaces provided by the NSURL and NSURLConnection classes. Most web services today use JavaScript Object Notation (aka JSON), and parsing JSON is handled in the iOS framework by the NSJSONSerialization class.