有没有办法获取原始文件未下载的filSize
属性?我得到了fileURL
和UIDocumentPickerViewController
,然后我试图检查fileSize
,但似乎它只是尚未下载的原始文件的别名。尺寸也不对。
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)])))
1条答案
按热度按时间nmpmafwu1#
试试这个: