Damaged apps when attempting to send as DMG or Zip across net

I have an app that builds and works fine in OSX. No errors.

If I attempt to send this for someone else to test it by uploading it, either as a zip or DMG, it causes it to break. This not only happens with people I send it to, but if I upload and download myself I also see the exact same error.

This happens on GDrive, Dropbox and WeTransfer.

This is using 2021.3.2f1 and build on an intel iMac with Monterey 12.4

What should I be doing so that I can send builds to other people for testing on OSX?

Try using xattr to view (and modify) the extended attributes on the file.

My guess is that this is just a security thing, and you can work around it in this way. But investigate and see what you find.

Thanks - what should I be looking out for?

If there’s anyone who can suggest why a build would be ‘corrupted’ by uploading then I’d be happy to hear any ideas.

Looks like Apple requires that it be notarized https://developer.apple.com/documentation/xcode/distributing-your-app-for-beta-testing-and-releases

EDIT: Okay, so this appears to be the solution.

The actual steps are as follows:

-Build from Unity to an xCode project.
-In Signing and Capabilities set to Automatically manage signing (and do this for any steps in the future)
-Set the Team as you would for iOS development (you need an apple dev account set up)
-Signing Certificate is set to Developer
-Hit the plus next to ‘all’ and add ‘Hardened Runtime’
-Make sure something is ticked on here or else the build will break
-Archive
-Distribute the app to DeveloperID and ‘upload’ - this sends it to be Notarised
-Await notarisation confirmation email
-Distribute again to DeveloperID
-Export this time
-I used a drive volume to upload it to Gdrive, but I suspect a zip is also fine
-Works!

1 Like

Looks like a regression to: Unity Issue Tracker - macOS builds no longer run when with a quarantine attribute due to incorrect codesigning

I am using unity addressables for on-demand packs and also using xcode plugin to build an instant app. I am using the unity’s Build Settings → Build and Run with my device connected. Everything works fine so far. On my side, I already had a published app store app and now building an instant app for the same build. So uninstall your custom built app and aim at a clean state is the key.

As for me, I re-sign each built version of the application with these commands:

xattr -cr "my-app-file.app"
xattr -lr "my-app-file.app"
sudo codesign -s - -f --deep "my-app-file.app"