IOS 文档提供商显示 "Doesn't support the file type"
IOS Document Provider shows "Doesn't support the file type"
我正在尝试实施 iOS 文档提供程序扩展,特别是为了让网页可以直接访问我的应用程序 "Flyskyhy" 中的文件。我已通读 normal documentation,并使用 XCode 中的标准方法将 DocumentProvider 扩展目标添加到项目中。我尚未更改该默认实现中的任何内容,但想先尝试一下。当从 Mail 访问时(通过添加附件操作),扩展会显示并被正确调用。
但是,当我尝试从 Safari 中的网页访问它时,该扩展程序没有显示在默认的源列表中:
然后,当我按 "More" 时,它会显示文本 "Doesn't support the file type":
有人知道可能会发生什么吗?我可以做些什么来完成这项工作?
编辑:
因为从未调用文档提供程序 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>
the public.content UTI matches all document types.
根据 Apple 技术开发人员支持,事实证明这是不正确的。您需要添加 public.data
UTI 以涵盖所有文档类型:
<key>UIDocumentPickerSupportedFileTypes</key>
<array>
<string>public.content</string>
<string>public.data</string>
</array>
我正在尝试实施 iOS 文档提供程序扩展,特别是为了让网页可以直接访问我的应用程序 "Flyskyhy" 中的文件。我已通读 normal documentation,并使用 XCode 中的标准方法将 DocumentProvider 扩展目标添加到项目中。我尚未更改该默认实现中的任何内容,但想先尝试一下。当从 Mail 访问时(通过添加附件操作),扩展会显示并被正确调用。
但是,当我尝试从 Safari 中的网页访问它时,该扩展程序没有显示在默认的源列表中:
然后,当我按 "More" 时,它会显示文本 "Doesn't support the file type":
有人知道可能会发生什么吗?我可以做些什么来完成这项工作?
编辑:
因为从未调用文档提供程序 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>
the public.content UTI matches all document types.
根据 Apple 技术开发人员支持,事实证明这是不正确的。您需要添加 public.data
UTI 以涵盖所有文档类型:
<key>UIDocumentPickerSupportedFileTypes</key>
<array>
<string>public.content</string>
<string>public.data</string>
</array>