ios 13.1 Cannot save file to App Directory

不问归期 提交于 2019-12-23 22:18:05

问题


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.

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)
        }

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?

来源:https://stackoverflow.com/questions/58173265/ios-13-1-cannot-save-file-to-app-directory

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!