Since converting a project from Swift 1.2 to Swift 2, I'm getting a crash (EXC_BAD_ACCESS) when dropping files into a drop zone. Here's the code:
override func performDragOperation(sender: NSDraggingInfo) -> Bool
{
let pboard: NSPasteboard = sender.draggingPasteboard()
if let urls = pboard.readObjectsForClasses([NSURL.self], options:nil) {
let appDelegate = NSApplication.sharedApplication().delegate as! AppDelegate
appDelegate.performActionForDropZone(self.identifier!, withDroppedItems: urls as! [NSURL])
}
return true
}
It's crashing in pboard.readObjectsForClasses() when I drop 1 or more files (and/or folders) into the drop zone, which triggers this function. This was running fine in Swift 1.2 (I'd get an array of URLs sent to the app delegate), and I'm at a loss to understand why it's crashing now, other than it might be a Swift 2 runtime problem. Any thoughts or suggestions would be greatly appreciated.