Just about every app these days deals in 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
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 really the question, ...
With Safari, you learn the way you learn best. Get unlimited access to videos, live online training,
learning paths, books, interactive tutorials, and more.