Is it an iOS (CocoaTocuh) app or OSX (Cocoa) ? Cocoa I guess.
I tested the following which compiles and run
var pboard = NSPasteboard()
let fileArray : [String] = pboard.propertyList(forType: .fileURL) as! [String]
But I get an error log (probably because I miss some register elsewhere):
OSX[13006:7378450] +[NSPasteboard allocWithZone:]: unrecognized selector sent to class 0x7fff8ca9c848
I completed with:
let pboard = NSPasteboard.general
print(pboard.name)
let fileArray = pboard.propertyList(forType: .fileURL) as! [String]
print("fileArray", fileArray)
I selected files in Finder, copied (in pasteboard) and ran.
Crash as for you:
NSPasteboardName(_rawValue: Apple CFPasteboard general)
Could not cast value of type '__NSCFString' (0x7fff8d157378) to 'NSArray' (0x7fff8d158db8).
2019-10-22 11:41:15.540177+0200 Test For XCode10_3 OSX[13562:7449634] Could not cast value of type '__NSCFString' (0x7fff8d157378) to 'NSArray' (0x7fff8d158db8).
So I tested
let pboard = NSPasteboard.general
print(pboard.name)
let fileArray = pboard.propertyList(forType: .fileURL) as! String
print("fileArray", fileArray)
I selected files in Finder, copied, and ran.
I got one name, the first selected:
NSPasteboardName(_rawValue: Apple CFPasteboard general)
fileArray file:///Users/ME/Desktop/Facture%20Appilys%20-%20MyFile.pdf
SO, .fileURL returns a String, not an array.
I could not find how to return an array (which selector ?)
I had a quick look here, but did not implement.
https://stackoverflow.com/questions/28504213/writing-fileurls-name-to-pasteboard