gpt4 book ai didi

swift - 带有 UTI 的 UIDocumentBrowserViewController 错误

转载 作者:可可西里 更新时间:2023-11-01 02:04:00 26 4
gpt4 key购买 nike

我使用 UIDocumentViewController(来自 Xcode 9 模板)为 iOS 11 创建了一个应用程序。我注册了文档类型以支持 .swift 文件(public.swift-script),并且它正在使用 open in place 和 Files 应用程序,但在应用程序的浏览器中,扩展名为 .swift 的文件被禁用,我无法选择它们。

我不知道是 iOS 11 错误还是我,因为如果我将文档类型设置为与 public.item 文件一起使用,它就可以工作。

注意:如果我允许选择多个项目,也会发生同样的事情,但如果我单击“全选”,文件将被正常选择。

最佳答案

我可能没有我需要的所有信息,但使用模板和我对你的问题的理解,我需要做的就是将 UTI 添加到 Info.plist 中,如下所示:

通过来源

<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeIconFiles</key>
<array/>
<key>CFBundleTypeName</key>
<string>Source Code</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>public.swift-source</string>
</array>
</dict>
<dict/>
</array>

Via the GUI

如果我误解了你的问题,请告诉我。

关于swift - 带有 UTI 的 UIDocumentBrowserViewController 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44599192/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com