1

我正在尝试实现一个 iOS 文档提供程序扩展,特别是为了使网页可以直接访问我的应用程序“Flyskyhy”中的文件。我已通读普通文档,并使用 XCode 中的标准方式将 DocumentProvider Extension 目标添加到项目中。我还没有更改该默认实现中的任何内容,但想先尝试一下。从 Mail 访问时(通过添加附件操作),该扩展程序会显示并正确调用。

但是,当我尝试从 Safari 中的网页访问它时,该扩展程序不会显示在默认源列表中:

在此处输入图像描述

然后,当我按“更多”时,它会显示文本“不支持文件类型”:

在此处输入图像描述

有谁知道可能会发生什么,以及我能做些什么来完成这项工作?

编辑:

因为从来没有调用过 Document Provider API,所以很可能是Info.plist. 有关信息,请参见此处:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>CFBundleDevelopmentRegion</key>
    <string>en</string>
    <key>CFBundleDisplayName</key>
    <string>Flyskyhy Documents</string>
    <key>CFBundleExecutable</key>
    <string>$(EXECUTABLE_NAME)</string>
    <key>CFBundleIdentifier</key>
    <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
    <key>CFBundleInfoDictionaryVersion</key>
    <string>6.0</string>
    <key>CFBundleName</key>
    <string>$(PRODUCT_NAME)</string>
    <key>CFBundlePackageType</key>
    <string>XPC!</string>
    <key>CFBundleShortVersionString</key>
    <string>1.0</string>
    <key>CFBundleSignature</key>
    <string>????</string>
    <key>CFBundleVersion</key>
    <string>1</string>
    <key>NSExtension</key>
    <dict>
        <key>NSExtensionAttributes</key>
        <dict>
            <key>UIDocumentPickerModes</key>
            <array>
                <string>UIDocumentPickerModeImport</string>
                <string>UIDocumentPickerModeExportToService</string>
            </array>
            <key>UIDocumentPickerSupportedFileTypes</key>
            <array>
                <string>public.content</string>
            </array>
        </dict>
        <key>NSExtensionMainStoryboard</key>
        <string>MainInterface</string>
        <key>NSExtensionPointIdentifier</key>
        <string>com.apple.fileprovider-ui</string>
    </dict>
</dict>
</plist>
4

1 回答 1

2

苹果文档说:

public.content UTI 匹配所有文档类型。

根据 Apple 技术开发人员支持,这被证明是不正确的。您需要添加public.dataUTI 以涵盖所有文档类型:

        <key>UIDocumentPickerSupportedFileTypes</key>
        <array>
            <string>public.content</string>
            <string>public.data</string>
        </array>
于 2016-07-26T10:15:49.413 回答