如何在 XCode 4.2 中设置文档类型?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7973769/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 22:18:07  来源:igfitidea点击:

How to set Document Types in XCode 4.2?

iosxcodexcode4.2

提问by user1007895

I have an iPhone app, and I would like it so that when a user clicks on a .pdf file as an email attachment, my App is one of the options to open it with. After some research, it seems that I need to add a Document Type in the info.plist. Problem is, I cannot find ANY tutorials explaining how to use the new Document Type GUI:

我有一个 iPhone 应用程序,我希望当用户单击 .pdf 文件作为电子邮件附件时,我的应用程序是打开它的选项之一。经过一番研究,似乎我需要在 info.plist 中添加一个文档类型。问题是,我找不到任何解释如何使用新文档类型 GUI 的教程:

Image here:

图片在这里:

Screenshot

截屏

Can anybody help me?

有谁能够帮助我?

回答by Michael Dautermann

This "Document Types" editor feature may be so new (was it introduced in 4.2) that the documentation sloths haven't had time to write anything about it.

这个“文档类型”编辑器功能可能非常新(它是在 4.2 中引入的),以至于文档树懒没有时间写任何关于它的东西。

I did find this Technical Q&A document that describes "How do I get my application to show up in the 'Open in...' menu on iOS for a specific document type?", which basically introduces the Xcode developer to the Document Types editor.

我确实找到了这个技术问答文档,它描述了“如何让我的应用程序显示在 iOS 上特定文档类型的‘打开方式...’菜单中?” ,它基本上向 Xcode 开发人员介绍了文档类型编辑器。

And more low level documentation.

以及更多低级文档

If you understand these basics and can figure out how to edit a raw Info.plist file, you should be good to go!

如果您了解这些基础知识并能弄清楚如何编辑原始 Info.plist 文件,那么您应该很高兴!

I hope this information helps you out.

我希望这些信息对您有所帮助。

回答by Rich Apodaca

It looks like there's still no official documentation on this. With the help of this SO answerdescribing how to write the info.plist file, I came up with this in Xcode 4.5.1:

似乎仍然没有关于此的官方文档。在这个描述如何编写 info.plist 文件的SO 答案的帮助下,我在 Xcode 4.5.1 中想到了这个:

enter image description here

在此处输入图片说明

This set of properties seems to be the minimum to get your app to run by tapping on an email attachment.

这组属性似乎是通过点击电子邮件附件来运行您的应用程序的最低要求。

回答by rob mayoff

It should be sufficient to set the "Name" field to "Portable Document Format" and the types field to "com.adobe.pdf".

将“名称”字段设置为“便携式文档格式”并将类型字段设置为“com.adobe.pdf”应该就足够了。