How to fix “Read-Write-Data Sandbox: error when using Mac Catalyst

MasterChief96, you are not alone. Here is my setup:

MacOS 10.15.3
Xcode 11.4.1

I create a brand new SwiftUI “Hello World” project, enable Mac as a target device, a.k.a. Catalyst.

I set the iOS deployment target to 13.2 (otherwise I get a MacOS runtime error saying I need Catalina 10.15.4)

Set the scheme to “My Mac”, compile and run and get:

[User Defaults] Couldn't write values for keys
    ApplicationAccessibilityEnabled
    AccessibilityEnabled
    FullKeyboardAccessFocusRingEnabled
setting preferences outside an application's container requires user-preference-write or file-write-data sandbox access

Since it refers to the sandbox, I change the “Signing and Capabilities” setting for App Sandbox to include Read/Write for User Selected and Downloads File Access.

I quite Xcode, delete the project’s Derived Data, open the project and run. The error messages persist when running on MacOS. (I do not see the messages when running on iOS.)

Just guessing here, but this appears to be yet another bug in the Catalyst environment? Maybe this bug is fixed in Catalina 10.15.4 but that update was such a disaster for me I had to back port to 10.15.3.

Leave a Comment