iphone - 为 iOS 应用创建您自己的 UTI

标签 iphone ios4 plist file-format

我正在开发的应用程序的文件有一个自定义文件格式,我希望能够使用 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/

相关文章:

ios - 获取 Error Domain=NSCocoaErrorDomain Code=261 简单案例

iphone - 生成适合 iPhone 查看大小的 PDF

iphone - 从照片库访问特定相册中的照片

ios - 将数据写入.plist

iPhone4 960x640 - 对应用程序有影响吗?

iphone - CorePlot 去除条形阴影效果

ios - 通过快速枚举从 PLIST 获取数据

iphone - 我的应用程序没有改变方向

iphone - 如何检测文件名中的中文/日文字符?

iPhone - 为什么有些方法是在 .m 上声明的,而不是在 .h 上声明的?