注册应用程序支持的文件类型以从其他应用程序打开文件

registering file types supported by an application to open files from other apps

我希望我的应用程序能够在 iOS 中从其他应用程序复制文件(图像、视频等),在查看了苹果文档和一些在线资源后我仍然无法做到让它工作。我附上了我的信息 plist 的图片。

这是该部分的 plist 代码:

<key>CFBundleDocumentTypes</key>
<array>
    <dict>
        <key>CFBundleTypeName</key>
        <string>All Files</string>
        <key>CFBundleTypeRole</key>
        <string>Editor</string>
        <key>LSHandlerRank</key>
        <string>Owner</string>
        <key>LSItemContentTypes</key>
        <array>
            <string>public.data</string>
            <string>public.content</string>
        </array>
    </dict>
</array>

如果您希望iOS在有人点击电子邮件附件时打开您的应用程序,注册文件类型将有所帮助,该附件具有您为您的应用程序声明的文件扩展名。

但我认为您想要的是能够将文件从另一个应用程序共享到您的应用程序。你需要 create an app extension of type "Share".