Swift NSSavePanelで Thread 1: EXC_BREAKPOINT

NSSavePanel runModal()

Swift macOS App デフォルトプロジェクトで、NSSavePanel()を使った場合Thread 1: EXC_BREAKPOINT が出て下記のようなエラーが表示されます。

[OpenSavePanels] ERROR: Unable to display save panel: your app has the User Selected File Read entitlement but it needs User Selected File Read/Write to display save panels. Please ensure that your app's target capabilities include the proper entitlements.

Sandboxの設定が「User Selected File = ReadOnly」になっているので「Read / Write」に変更すれば解決します。

User selected file read write
User Selected File = Read / Write

一度でもビルドに成功していてUser Selected File = ReadOnlyに変更した場合下記のメッセージが出ます

error: Entitlements file "xxx.entitlements" was modified during the build, which is not supported. You can disable this error by setting 'CODE_SIGN_ALLOW_ENTITLEMENTS_MODIFICATION' to 'YES', however this may cause the built product's code signature or provisioning profile to contain incorrect entitlements. (in target 'xxx' from project 'xxx')