ios - 如何在 iOS 文档选择器中选择 .pgw 文件?
问题描述
我正在开发一个需要从本地设备存储读取 .pgw 文件( https://en.wikipedia.org/wiki/World_file )的 iOS 应用程序。我的设备上有一个示例文件,我正试图从应用程序中打开它。当我打开文档选择器时,我可以看到该文件,但它是灰色的,我无法选择它。在该屏幕截图中,malaysia-google-earth.pgw 是我要打开的文件。
如果我将该文件的文件扩展名更改为 .txt,它不再灰显,我可以选择它。所以我知道这是文件扩展名的问题。
我尝试将 .pgw 添加到应用程序支持的文档类型列表中,但由于此扩展没有统一类型标识符,我不确定我是否正确添加它。我的 Info.plist 文件包含以下键:
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeIconFiles</key>
<array/>
<key>CFBundleTypeName</key>
<string>PNG World File</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>public.pgw</string>
</array>
</dict>
</array>
<key>LSSupportsOpeningDocumentsInPlace</key>
<true/>
<key>UIFileSharingEnabled</key>
<key>UTExportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.data</string>
</array>
<key>UTTypeDescription</key>
<string>PNG World File</string>
<key>UTTypeIconFiles</key>
<array/>
<key>UTTypeIdentifier</key>
<string>public.pgw</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<array>
<string>pgw</string>
</array>
</dict>
</dict>
</array>
<true/>
我使用的是 iOS 版本 13.6,这是一个使用 react-native-document-picker 的 React Native 应用程序。
解决方案
推荐阅读
- sql - 在另一个表上找到最接近的值
- r - 尝试将 csv 数据集实施到 r 时出错
- grails - 升级到 grails 2.5.6 后,hdiv 插件不加载主页
- typescript - Vue 3 同级组件通信
- excel - Excel公式根据最大行结果查找特定数据
- git - 如何让 gitignore 忽略你的仓库中的一些文件夹
- linux - rdp插件有问题!我无法通过 remmina 工作
- javascript - 语义 ui 库中 dropdown() 的定义
- javascript - 在 html 中链接 js 文件及其库
- javascript - React 中的 Winwheel 与图像