I have the following code:
document?.open { success in
if success {
print("file opened")
self.consumed = self.document?.consumed
} else {
print("file read failure")
}
}
As can be seen, I have a print for both success and failure. But neither prints.
The reasonable question is the file is not there, not readable or something. Therefore, I have added before this code the following:
if document != nil {
print("not nil")
let asString = document?.fileURL.path
let toast = FileManager.default.fileExists(atPath: asString!)
if toast {
print("file exist")
} else {
print("file does not exist")
}
} else {
print("nil")
}
if FileManager.default.isReadableFile(atPath: (document?.fileURL.path)!)
{
print("readable")
}
else
{
print("not readable")
}
This indicates for me that it is: not nil, exists, and readable.
Is there sometime I am missing to have this completion code not execute? It would be great to be able to open the file, but I think the fact that it is not operating is the first step.
Of note about the file. It is a file that is read from the bundle and copied to Documents directory. I have looked at the attributes of the file and have found nothing odd.