swift - ios 13.1 无法将文件保存到应用程序目录

我在 ios 13 中编写了一个应用程序并将我自己的文件类型保存到应用程序自己的目录文件夹中。我可以在"file"应用程序中看到它,以及我的应用程序名称和图标。

我已将我的 ipad 更新到 ios 13.1,但无法保存或打开任何文件。如果我打开文件应用程序,我的应用程序目录甚至不存在。为什么这会改变?我试过卸载应用程序,然后重新安装。我检查过我的权限和以前一样。就像没有创建主应用程序目录一样,因此任何写入它的尝试都不会成功。

我正在使用这种方法获取目录并保存:

    let DocumentDirURL = try! FileManager.default.url(for: .documentDirectory, in: .userDomainMask, appropriateFor: nil, create: true)
    let url = DocumentDirURL.appendingPathComponent(name).appendingPathExtension(fileExt)

    do {
            try jsonString!.write(to: url, atomically: true, encoding: String.Encoding.utf8)
            print(url.path)
        }

我检查了我在 Info.plist 文件中的权限,“支持打开文档”和“itunes 文件共享”以及我的 UTI 文件类型信息都已打开。

有没有人知道可能导致这种行为的任何变化?我现在是否需要手动为我的文件创建文档文件夹?

最佳答案

您是否尝试过在 Info.plist 文件中使用等于 YES 的键 UIFileSharingEnabledLSSupportsOpeningDocumentsInPlace项目? 这对我有用。

https://stackoverflow.com/questions/58173265/

相关文章:

netlogo - 如何使用 Netlogo 中的行为空间获取海龟到达不同 10 个补丁的滴答时间?

python - 使用 Python 类型模块指定序列或列表的长度

reactjs - 错误 : [mobx] Computed values are not allo

google-apps-script - 如何使用 google sheet api v 4 将 b

python - 如何使用 matplotlib.errorbar 更改单个标记的颜色?

python - 如何在没有数据库的情况下使用 JWTTokenUserAuthentication

email - MailApp.sendEmail 所有邮件被阻止

google-chrome - 一些 Font Awesome 图标在 Chrome 中不显示

c# - 程序集绑定(bind)重定向 : How and Why?

exception - Flutter:应用程序崩溃并出现运行时异常 - 回复已提交