'Get size of the file located in iCloud
Is there a way to get the filSize attribute of the original file that is not been downloaded yet?
I've got the fileURL with UIDocumentPickerViewController and then I'm trying to check the fileSize but it seems it's just an alias to the original file that's not downloaded yet. And the size isn't correct.
debugPrint("size: ", try? fileURL.resourceValues(forKeys: [.fileSizeKey, .ubiquitousItemDownloadingStatusKey]))
"fileURL: " file:///private/var/mobile/Library/Mobile%20Documents/com~apple~CloudDocs/Downloads/.vvvvv.mp4.icloud
"size: " Optional(Foundation.URLResourceValues(_values: [__C.NSURLResourceKey(_rawValue: NSURLUbiquitousItemDownloadingStatusKey): NSURLUbiquitousItemDownloadingStatusNotDownloaded, __C.NSURLResourceKey(_rawValue: NSURLFileSizeKey): 340], _keys: Set([__C.NSURLResourceKey(_rawValue: NSURLUbiquitousItemDownloadingStatusKey), __C.NSURLResourceKey(_rawValue: NSURLFileSizeKey)])))
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
