Post

Replies

Boosts

Views

Activity

how to use filehandle at MacOS 11?
why I can`t read the file in FileHandle? Mac OS 11 swift 5 file = try FileHandle(forReadingFrom: url)         fileQueue = DispatchQueue(label: "model.source.opt.\(url.lastPathComponent)")         var jsonData = Data()         fileQueue.sync {             if let lenthData = try? self.file.read(upToCount: 8) {                 var lenth = UInt64(lenthData[0])                 for i in 1 ..< lenthData.count {                     lenth = lenth & (UInt64(lenthData[i] << (8 * i)))                 }                 print(lenth)/*print the 0*/                 self.file.waitForDataInBackgroundAndNotify()                 if let j = try? self.file.read(upToCount: Int(lenth)) {                     jsonData = j                 }                 print(jsonData)/*print the 0 bytes*/                 self.firstFrameOffset = try! self.file.offset()             }         }
0
0
366
Nov ’20