Skip to content

[NSSavePanel savePanel] can return NULL in sandboxed apps, causing panic #813

@SuchAFuriousDeath

Description

@SuchAFuriousDeath

Contrary to Apple documentation, [NSSavePanel savePanel] seems like it can return nil when called from a sandboxed macOS app that lacks the com.apple.security.files.user-selected.read-write entitlement. This causes a panic in objc2-app-kit:

unexpected NULL returned from +[NSSavePanel savePanel]

While Apple's documentation doesn't mention this, NSSavePanel.savePanel silently returns nil when the app is sandboxed but only has read-only file access entitlement instead of read-write. This has been discovered in the Apple Developer Forums:
https://developer.apple.com/forums/thread/104913

Here are examples of the panic happening in Ruffle:
https://github.com/ruffle-rs/ruffle/issues?q=is%3Aissue%20state%3Aopen%20%22unexpected%20NULL%20returned%20from%22

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-frameworkAffects the framework crates and the translator for thembugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions