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()
}
}
Post
Replies
Boosts
Views
Activity
I added the breakpoint at line 232, but it didn't execute
swift code - https://developer.apple.com/forums/content/attachment/4a20f519-fa76-4219-bdd2-ea09e1f69a8e
Is the data buffeting algorithm of AVCaptureVideoDataOutput processed by the buffeting algorithm?
Under what condition is kCVPixelFormatTypeDepthFloat32 and kCVPixelFormatTypeDisparityFloat32 supported?
How do I get raw image data from the iPhone 11 Pro's three cameras?
Use AVFoundation or Other developer Kit?