I have a simple UIDocument subclass with overriding load
and contents
functions.
Before updating on iOS 13 json document was saved in url "/private/var/mobile/Library/Mobile Documents/iCloud~appbundle/Documents/EFB7FCBA96684AC0B101E3CD829E6996.json"
In current iOS version 13.2.2 (after updating) this document does not open:
let cloudDocument: ICloudDocument = ICloudDocument(fileURL: url)
cloudDocument.open { (openSuccess) in
if openSuccess {
success()
} else {
// in my case openSuccess is false
failure()
}
}
Debug information.
After overriding handleError
in ICloudDocument
override func handleError(_ error: Error, userInteractionPermitted: Bool) {
print("userInteractionPermitted - \(userInteractionPermitted)")
print(error)
}
in console:
userInteractionPermitted - true
Error Domain=NSCocoaErrorDomain Code=256 "The file “EFB7FCBA96684AC0B101E3CD829E6996” couldn’t be opened." UserInfo={NSURL=file:///private/var/mobile/Library/Mobile%20Documents/iCloud~appbundle/Documents/EFB7FCBA96684AC0B101E3CD829E6996.json}
If I use cloudDocument.read
method in ICloudDocument it works well with receiving data from file, but open
throws the error.
DocumentState cloudDocument.documentState
of document is closed.
File options:
> print(FileManager.default.isWritableFile(atPath: url.path))
true
> print(FileManager.default.isReadableFile(atPath: url.path))
true
URLResourceKeys:
URLResourceKey.ubiquitousItemIsUploadingKey - true
URLResourceKey.ubiquitousItemIsUploadedKey - false
URLResourceKey.ubiquitousItemUploadingErrorKey - nil
URLResourceKey.ubiquitousItemHasUnresolvedConflictsKey - false
URLResourceKey.isUbiquitousItemKey - true
URLResourceKey.ubiquitousItemDownloadingStatusKey - "NSURLUbiquitousItemDownloadingStatusCurrent"
I found one link about this problem without answer https://forums.developer.apple.com/thread/126889
Any ideas?
Restaring iOS solved this problem. I think that after updating into iOS 13 and migration, system needs additional reload.