How to show “Open In…” when a user tries to open email attachments in iOS

后端 未结 2 1781
刺人心
刺人心 2020-12-24 09:34

I\'ve seen some iOS apps have this function: When a user tries to open an email attachment, they can press and hold on the attachment for a couple of seconds, and a popup me

相关标签:
2条回答
  • 2020-12-24 10:01

    Your app has to register its ability to open specific file types by setting the CFBundleDocumentTypes in its plist. Here's an example of GoodReader's XML for opening PDFs.

    When you app is called to open a file, you can find the information about the file in application:didFinishLaunchingWithOptions:, which is passed a dictionary with the key UIApplicationLaunchOptionsURLKey

    You'll get a URL pointing to the file to open. I think that it's read-only and you'll have to save your own version if you want to change it.

    0 讨论(0)
  • 2020-12-24 10:18

    http://developer.apple.com/library/ios/#documentation/FileManagement/Conceptual/DocumentInteraction_TopicsForIOS/Articles/RegisteringtheFileTypesYourAppSupports.html%23//apple_ref/doc/uid/TP40010411-SW1

    Is what you need :-)

    0 讨论(0)
提交回复
热议问题