Search code examples
swiftuimac-catalyst

SwiftUI .fileImporter on MacOS Catalyst


Goal: import images using SwiftUI .fileImporter modifier, on MacOS Catalyst.

Xcode Version 12.4 (12D4e)

MacOS 11.2.3 (20D91)

Problem: When I lick to import an image, I get the crash bellow:

ERROR: Unable to display open panel: your app is missing the User Selected File Read app sandbox entitlement. Please ensure that your app's target capabilities include the proper entitlements.

Any help is much appreciated! : )

<UIDocumentPickerViewController: 0x7faf38ee9d20> from detached view controller <TtGC7SwiftUI19UIHostingControllerVVS_22_VariadicView_Children7Element: 0x7faf38e9f8e0> is discouraged. 2021-04-13 11:18:03.882067+0200 tStudio[12670:69301] [OpenSavePanels] ERROR: Unable to display open panel: your app is missing the User Selected File Read app sandbox entitlement. Please ensure that your app's target capabilities include the proper entitlements.


Solution

  • Fixed with this. Just go to your target, and check file access as bellow

    enter image description here