App extensions allow functionality and content from an app to be available to users outside of the app. Extensions can perform specific tasks in other apps like sharing content or displaying sports scores. Common types of extensions include Today widgets, Share extensions, and Actions extensions. Extensions have their own lifecycle and communicate indirectly with the containing app. This document provides an overview of how to create app extensions in iOS and OS X.
2. App Extension
• Starting in iOS 8.0 and OS X v10.10, an app
extension lets you extend custom
functionality and content beyond your app
and make it available to users while they’re
using other apps.
• You create an app extension to enable a
specific task; after users get your extension,
they can use it to perform that task in a
variety of contexts.
www.letsnurture.com
3. Example
• For example, if you provide an extension that
enables sharing to your social sharing website,
users can use it to post a remark while they’re
reading email messages or surfing the web.
• Or if you provide an extension that displays
current sports scores, users can put it in
Notification Center so that they can get the latest
scores when they open the Today view.
• You can even create an extension that provides a
custom keyboard that users can use in place of
the iOS system keyboard.
www.letsnurture.com
5. Types of Extensions
• Today (iOS and OS X): widgets for the Today view of Notification Center
• Share (iOS and OS X): post content to web services or share content with
others
• Actions (iOS and OS X): app extensions to view or manipulate inside
another app
• Photo Editing (iOS): edit a photo or video in Apple's Photos app with
extensions from a third-party apps
• Finder Sync (OS X): remote file storage in the Finder with support for
Finder content annotation
• Storage Provider (iOS): an interface between files inside an app and other
apps on a user's device
• Custom Keyboard (iOS): system-wide alternative keyboards
www.letsnurture.com
13. How an App Extension Communicates
www.letsnurture.com
14. A running app extension can communicate
indirectly with its containing app
www.letsnurture.com
15. An app extension cannot:
• Access a sharedApplication object, and so cannot use any of the
methods on that object
• Use any API marked in header files with
the NS_EXTENSION_UNAVAILABLE macro
• Access the camera or microphone on an iOS device
• Perform background tasks (although an app extension can initiate
uploads or downloads using anNSURLSession object)
• Receive data using AirDrop
• (An app extension can send data using AirDrop in the same way an
app does: by employing theUIActivityViewController class.)
www.letsnurture.com
16. An app extension’s container is distinct from its
containing app’s container
www.letsnurture.com