In Swift 3 / Xcode8.1 / 10.12.2 I am trying to use NSOpenPanel to get a text file with the following code written by DenBeke
@IBAction func browseFile(sender: AnyObject)
{
let dialog = NSOpenPanel();
dialog.title = "Choose a .txt file";
dialog.allowedFileTypes = ["txt"];
if (dialog.runModal() == NSModalResponseOK)
{
let result = dialog.url
if (result != nil) {
let path = result!.path
print("browseFile path: \(path)")
}
} else {
return
}
}
The code opens an open dialog box, as expected, and I can select the file. When you click the "Open" button, the application crashes. In the console, I get:
FI_TFloatingInputWindowController object 0x60800009c0c0 is overridden, but already freed; break on objc_overrelease_during_dealloc_error for debugging
When I run the code and open a dialog, in the console I get
[ ] [] URL: file:////ruediheimlicher/Documents/LoggerdataDir/Messungen/, : = BRCloudDocsErrorDomain Code = 12 " :" com.apple.Documents '"UserInfo = {NSDescription = :' com.apple.Documents '}
.
NSOpen NSSave , : Crash .
, Swift3/sierra?