简体   繁体   English

Swift-App Extension打开PDF文件

[英]Swift - App Extension to open PDF files

I want my app to be able to copy PDF files from Safari, just like adobe reader can copy them from Safari. 我希望我的应用程序能够从Safari复制PDF文件, 就像Adobe Reader可以从Safari复制PDF文件一样。

Is this a private API that adobe reader uses? 这是Adobe Reader使用的私有API吗? I can't find any guide about such action and by reading apple documentation I became more confused and now I have no idea if I need to use a UIActivityViewController or a UIDocumentInteractionController. 我找不到任何有关此类操作的指南,并且通过阅读Apple文档变得更加困惑,现在我不知道是否需要使用UIActivityViewController或UIDocumentInteractionController。

You need to look into the Document Interaction API 您需要研究文档交互API

You should specifically look into the Registering Your Support of File Types and Opening Files From Other Apps sections. 您应该专门研究“ Registering Your Support of File TypesOpening Files From Other Apps部分。

Once you've registered PDF as a file type your app supports, your app will appear in the list that shows when you press the More... button. 将PDF注册为您的应用程序支持的文件类型后,您的应用程序将出现在按“ More...按钮时显示的列表中。

  • If your app is the only app that can open PDFs, it will appear instead of "Adobe Acrobat" on the right. 如果您的应用程序是唯一可以打开PDF的应用程序,它将显示在右侧,而不是"Adobe Acrobat"
  • If you have multiple apps that can open PDFs on your phone, iOS will choose one, but you have no control over which one. 如果您有多个可以在手机上打开PDF的应用程序,iOS将选择一个,但您无法控制哪个。 Even the user has no control over which one. 甚至用户也无法控制哪一个。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM