ios - Cannot open file created by previous app version in the user library -
oddly can't find info regarding error. i'm updating old ios app stored user files in user library, in subdirectory called "private documents".
i can list files created fine, cannot read them, , receive error "the file “1.xxx” couldn’t opened because don’t have permission view it."
let urls = filemanager.default.urls(for: .librarydirectory, in: .userdomainmask) guard let documentdirectory = urls.first else { print("cannot find old lib documents directory") return } guard let files = try? filemanager.default.contentsofdirectory(at: documentdirectory.appendingpathcomponent("private documents", isdirectory: true), includingpropertiesforkeys: nil, options: filemanager.directoryenumerationoptions.skipshiddenfiles) else { print("cannot load old lib files directory") return }
files contains array of file urls in directory, correctly.
however, if call filemanager.default.isreadablefile, function returns true, trying copy file data(contentsof: file) object fails above error.
help appreciated!
update: checked app signing etc, comparing current app store version testflight build have same issue.
well well... issue file reading directories (packages). hence permissions, ownership, isreadable/iswritable correct.
it's shame apple error doesn't state that's issue!
Comments
Post a Comment