ios 13.1无法将文件保存到App目录 [英] ios 13.1 Cannot save file to App Directory

查看:344
本文介绍了ios 13.1无法将文件保存到App目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在ios 13中编写一个应用程序,并将自己的文件类型保存到应用程序自己的目录文件夹中。我可以在文件应用程序中看到此信息,并带有我的应用程序名称和图标。

I was writing an app in ios 13 and saving my own filetype to the apps own directory folder. I could see this in the Files app, with my apps name and icon.

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

I have updated my ipad to ios 13.1 and cannot save or open any files. If I open the Files app, my apps directory doesn't even exist. Why would this have changed? I have tried uninstalling the app, and reinstalling it. I have checked my permissions were as before. It is like the main app directory is not being created, therefore any attempts to write to it do not succeed.

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

I am using this method to get the directory and save:

    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文件类型信息。

I have checked my permissions in the Info.plist file and the 'supports opening documents' and the 'itunes file sharing' are both turned on, along with my UTI File type info.

有人知道可能导致此行为的任何更改吗?我现在是否需要手动为文件创建文件文件夹?

Does anybody know of any changes that may have caused this to act this way? Do I manually need to create the documents folder for my files now?

推荐答案

您是否尝试过使用键 UIFileSharingEnabled LSSupportsOpeningDocumentsInPlace 等于信息中的 YES .plist 文件项目?
这对我有用。

Have you tried to using the keys UIFileSharingEnabled and LSSupportsOpeningDocumentsInPlace equal to YES in your Info.plist file project? This works for me.

这篇关于ios 13.1无法将文件保存到App目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆