Crash with NSOpenPanel and XCode 7

Using El Capitan and XCode 7, the following trivial snippet of code causes a Swift related exception to be thrown:


func openDocument(sender: AnyObject?) {
        let panel = NSOpenPanel();
        let types = [ "abc", "def" ]

        panel.allowedFileTypes = types;
        panel.runModal();
    }


The exception is "[Swift._SwiftDeferredNSArray supportsSecureCoding]: unrecognized selector sent to class 0x1002de2c0". And it is triggered when assigning types to allowedFileTypes.

I've got the same problem here but on Yosemite. I think it's a bug in the 10.11 SDK.

The only work-around I've found is to deactivate sandboxing until 10.11 sdk get fixed.


Sandboxing is a often a major issue with beta SDK, I always turn it OFF during beta developpement.

I'm on Yosemite as well (with XCode 7 beta 2) and with the exact same issue. Disabling sandboxing like Pyroh suggested worked for me.


For those not sure where to do it, click on the left sidebar on "AppName.entitlements" and for "App Sandbox" choose the value "NO" instead of "YES".


Alternatively, you can select your App on the left sidebar (root/top level) and in the "Capabilities" tab, toggle App Sandbox (first item) to OFF instead of ON.


This error exists even if, in the App Sandbox Capabilities, I give access to all folders with Read/Write permissions.

I'm no longer having this issue with XCode 7 Beta 3, and App Sandbox enabled.

Crash with NSOpenPanel and XCode 7
 
 
Q