Chapter 17. Sharing and Notifications

Just about every app these days deals with some kind of content—whether it’s business documents written in an office suite, images created in an image editor, or even high scores earned in a game. Users frequently want to be able to show this content to other people, and while there’s a very good established system in place for sharing documents, smaller snippets of content like URLs, individual photos, or other miscellany have fewer well-defined and easy-to-use options.

Starting in OS X 10.8 and iOS 6, the OS provides built-in sharing APIs that let your application send various kinds of content to services that can handle them. For example, online services like YouTube and Vimeo can receive video files and share them over the Internet, the Messages app can send text, photos, and videos, and email can send just about any file.

In addition to sending content to other locations, the OS is also capable of receiving notifications. These are short messages sent from a server to an iOS device, which are received regardless of whether the app is running or the phone is awake.

In this chapter, you’ll learn how to share data from your application using the built-in sharing APIs, and how to send and receive both push and local notifications.

Sharing

From the user’s perspective, the problem of data sharing can be rephrased as, “How can I send this to someone else?” From your application’s perspective, however, the problem of data sharing is ...

Get Learning Cocoa with Objective-C, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.