Info.plist
extension point identifier keys, are described in the section NSExtensionPointIdentifier..appex
.Info.plist
file), a view controller class, and a default user interface, all of which are defined by the extension point. The default view controller class (or principal class) can contain stubs for the extension point methods you should implement.Info.plist
file identifies the extension point and may specify some details about your extension. At a minimum, the file includes the NSExtension
key and a dictionary of keys and values that the extension point specifies. For example, the value of the required NSExtensionPointIdentifier
key is the extension point’s reverse DNS name, such as com.apple.widget-extension
. Here are some of the other keys and values you may see in your extension’s NSExtension
dictionary:NSExtensionAttributes
PHSupportedMediaTypes
for a Photo Editing extension.NSExtensionPrincipalClass
SharingViewController
. When a host app invokes your extension, the extension point instantiates this class.NSExtensionMainStoryboard
(iOS extensions only)MainInterface
.com.apple.security.application-groups
entitlement. com.apple.security.files.user-selected.read-only
entitlements by default. You might need to define additional capabilities for your extension if it needs to do things like use the network or access the user’s photos or contact information. beginRequestWithExtensionContext:
method), your app extension can use the extensionContext
property on its principal view controller to get the context. Child view controllers also have access to this property through chaining.NSExtensionContext
class to examine the context and get the items within it. Often, it works well to get the context and items in your view controller’s loadView
method so that you can display the information in your view. To get your extension’s context you can use code like the following: Hp photosmart 3310 scanner software mac.NSExtensionContext *myExtensionContext = self.extensionContext;
inputItems
property, which can contain the items your app extension needs to use. The inputItems
property contains an array of NSExtensionItem
objects, each of which contains an item the extension can work on. To get the items from the context object, you might use code like this:NSArray *inputItems = myExtensionContext.inputItems;
NSExtensionItem
object contains a number of properties that describe aspects of the item, such as its title, content text, attachments, and user info.attachments
property contains an array of media data that’s associated with the item. For example, in an item associated with a sharing request, the attachments
property might contain a representation of the webpage a user wants to share.completeRequestReturningItems:completionHandler:
method, optionally returning NSExtensionItem
objects to the host app, or the cancelRequestWithError:
method, returning an error code.completeRequestReturningItems:completionHandler:
method, provide a completionHandler
block to, at minimum, suspend your app extension should the system ask you to. For details, read the documentation for the completionHandler
block of this method, in NSExtensionContext Class Reference. NSURLSession
class to initiate a transfer in the background. Because a background transfer uses a separate process, the transfer can continue, as a low priority task, after your extension completes the host app’s request and gets terminated. To learn more about using NSURLSession
in your extension, see Performing Uploads and Downloads.UIBackgroundModes
key in your app extension’s Info.plist
file, the extension will be rejected by the App Store. (To learn more about this key, see UIBackgroundModes.)CFBundleDisplayName
value, which you can edit in the extension’s Info.plist
file. If you don’t provide a value for the CFBundleDisplayName
key, your extension uses the name of its containing app, as it appears in the CFBundleName
value.widget.description
key in your widget’s InfoPlist.strings
file.MyExtensionName
or by clicking the scheme pop-up menu in the Xcode toolbar and choosing MyExtensionName
.CFBundleIdentifier
property, instead of the value of the CFBundleDisplayName
property.