Opening Supported File Types
The system may ask your application to open a specific file and present it to the user. This typically occurs because another application encountered the file and used a document interaction controller to handle it. You receive information about the file to be opened in the application:willFinishLaunchingWithOptions:
or application:didFinishLaunchingWithOptions:
method of your application delegate. If your application handles custom file types, you must implement this delegate method (instead of the applicationDidFinishLaunching:
method) and use it to initialize your application.
The options dictionary passed to the application:willFinishLaunchingWithOptions:
or application:didFinishLaunchingWithOptions:
method contains information about the file to be opened. Specifically, your application should look in this dictionary for the following keys:
UIApplicationLaunchOptionsURLKey
contains anNSURL
object that specifies the file to open.UIApplicationLaunchOptionsSourceApplicationKey
contains anNSString
with the bundle identifier of the application that initiated the open request.UIApplicationLaunchOptionsAnnotationKey
contains a property list object that the source application wanted to associate with the file when it was opened.
If the UIApplicationLaunchOptionsURLKey
key is present, your application must open the file referenced by that key and present its contents immediately. You can use the other keys in the dictionary to gather information about the circumstances surrounding the opening of the file.
Copyright © 2010 Apple Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2010-11-15