(Iphone) associate an App to some file extension to open email attachments in Mail app
I found that some application, like "GoodReader" or "Docs to Go", once installed can be activated using the "Open in" function when opening an email attachment in the Mail App. How to add this function to have my App to be associated to some kind of documents (like pdf) ?
The idea is to have 开发者_Go百科an easy way to get mail attachments to be used directly inside an app.
Edit: I found this document and think it fits my question:
Document Support
An application can now register the file types it supports with the system and receive notifications when a file of the given type needs to be opened. It does this by including the CFBundleDocumentTypes
key in its Info.plist
file. An application that registers one or more file types may also be expected to open files of those types at some point later. It does this by implementing the
application:didFinishLaunchingWithOptions:
method in its application delegate and look for a file
in the UIApplicationLaunchOptionsURLKey
key of the provided dictionary.
Complementing the ability to open files of known types is the addition of the
UIDocumentInteractionControllerclass
in the UIKit
framework. This class provides a user-based
interaction model for managing files that your application does not know how to open. The document interaction controller provides options for previewing the contents of a file in place or opening it in another application. Document interaction controllers are particularly useful for email applications or applications that may download files from the network.
take a look at Custom URL Schemes and UIDocumentInteractionController. If you are looking to add the "open in" menu, the second link is what you need. If you are looking to register as a "PDF reader" this link (scroll to section about registering your app for certain types) should work iPad Programming Guide
精彩评论