我正在开发的应用程序的文件有一个自定义文件格式,我希望能够使用 iOS 的“打开方式...”功能,该功能可以让用户例如通过电子邮件互相发送文件,然后直接在应用程序中打开它。
我已经在 Info.plist 文件中添加了 CFBundleDocumentType 内容,但问题是 LSItemContentTypes。 From what I've read ,我需要提供实际的文件 作为一个 UTI,而不仅仅是说“.myfileextension”,而且我找不到很多关于如何在 iOS 应用程序中创建 UTI 的信息。
有人知道吗?
最佳答案
您将需要阅读 Apple 提供的以下主题:
Adopting Uniform Type Identifiers
Introduction to Uniform Type Identifiers Overview
Declaring New Uniform Type Identifiers
From the documentation:
If your application uses proprietary data formats, you should declare them in the Info.plist file of your application bundle. Some guidelines:
Your UTI string must be unique. Following the reverse-DNS format beginning with com.companyName is a simple way to ensure uniqueness. While the system can support different UTI strings with the same specification, the reverse is not true.
If your code relies on third-party UTI types that may not be present on the system, you should declare those UTIs as imported types in your bundle.
Be sure to add conformance information if your proprietary type is a subtype of one or more existing types. In most cases you should not specify conformance to a nonpublic type, unless you are also declaring that type in your bundle. For a list of public and Apple-defined UTIs, see "System-Declared Uniform Type Identifiers"
关于iphone - 为 iOS 应用创建您自己的 UTI,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4539858/