Gatekeeper Alerts When Running on Mac Catalyst

You may experience the following alerts when running on Mac Catalyst from Xcode and wonder how to fix the issue.

“PSPDFKit.framework” is damaged and can’t be opened. You should move it to the Trash “Instant.framework” cannot be opened because the developer cannot be verified
damaged developer-cannot-be-verified

In this scenario, Xcode is finding the XCFrameworks extracted frameworks in the build directory and trying to link them instead of linking the signed frameworks in the app bundle. This issue only occurs when integrating PSPDFKit manually.

To fix this issue, you can either integrate PSPDFKit using Swift Package Manager, or you can add the following script to a Run Script Phase in your app’s target to remove the quarantine attribute that could’ve been added during the download:

# For Mac Catalyst, Xcode is finding the XCFrameworks extracted frameworks in the build directory
# and trying to link them instead of the signed frameworks in the app bundle.
# We remove the quarantine attribute that could have been added during download
# so that this doesn't lead to a warning when the app is launched via Xcode.
if [ "${IS_MACCATALYST}" = "YES" ]; then
    for framework in $TARGET_BUILD_DIR/*.framework; do
        if [ -d "$framework" ]; then
            xattr -d -r com.apple.quarantine "$framework"
        fi
    done
fi

For more details, take a look at the Clear Quarantine Attribute script in the Run Script Phase from the Catalog example project.

clear-quarantine-attributes-run-phase-script