Post

Replies

Boosts

Views

Activity

"zero length data" error
I had a customer feedback about a "zero length data" error which was captured using an exception handler and displayed using NSAlert. My app employs [NSURLSession dataTaskWithURL:] to download XML and image data. But I got no idea what it is about. I assume it's related to NSData, but this error never happened before (for years). Does anyone have any idea about the source of this error?
2
0
644
Feb ’24
Any virtual machine software on M1/arm?
I used to run VirtualBox on macOS to run Windows guests for some reasons. Recently I bought a new Mac mini M1, now I have a problem - VB does not have a stable release for arm (yet). What other options do I have? BTW, I came across this doc article (https://developer.apple.com/documentation/virtualization/running_macos_in_a_virtual_machine_on_apple_silicon). I read thru it, but could not conclude if it offers the same functionalities as a full-blown VM suite; and more specifically I want to run Windows guests.
2
0
1.6k
Feb ’24
TableView.makeView question
Is it possible that I bypass tableView.makeView so that I can create a NSTableCellView on the fly (based on some logics)? func tableView(_ tableView: NSTableView, viewFor tableColumn: NSTableColumn?, row: Int) -> NSView? { if NSTableColumn.identifier.rawValue == "labelColumn" { let myCellView = NSTableCellView() myCellView.textField.strinValue = "label text" return myCellView } else { let complexView = loadFromNib() // of NSTableCellView // populate complexView return complexView } }
0
0
347
Jan ’24
FileManager.enumerator and URL problem
I have the following pseudo code: func load(at packageURL: URL) { let realPackageURL = packageURL.resolvingSymlinksInPath() guard let it = fileMan.enumerator(at: realPackageURL) for case let fileURL as URL in it { print(fileURL) // Get filename relative to package root directory let relativeFileName = String(filePath.suffix(filePath.count - packagePath.count)) } } When called with "file:///tmp/some.app", the enumerated fileURL is actually file:///private/tmp/GIMP.app/Contents/ packageURL.resolvingSymlinksInPath() actually does nothing, I assume /tmp is a hard link. This makes it impossible to get a correct relative path. Is there any remedy for this?
2
0
483
Jan ’24
Reading multi parts of a file concurrently
I have a need to read first half and second half of a file concurrently. Is there any best practices for this scenario? BTW, I did research on DispatchIO but it turned out DispatchIO is all about asynchronous operations on a single file handle; it cannot perform parallel reading. // naive approach Task { fileHandle.read(into:buffer) } Task { // seek to file size / 2 fileHandle.read(into:buffer) }
5
0
741
Jan ’24