Hi,
I have two Mac Catalyst C# MAUI apps. First is main application, second is updater. My updater works like that: it downloads ZIP-archive of .app of main application from server, and extracts it to directory where app is placed(folder in user directory, with two .apps of updater and main one), overwriting files.
As an aside, directly overwriting the existing files like this is a bad idea, as any intermediate failure will leave you with a partially updated, broken, app. That right approach here is to:
-Use "NSFileManager.url(for:in:appropriateFor:create:)" to get a temporary directory location that's on the same volume as your existing app install.
-
Copy your existing app into that temporary directory.
-
Modify that copy to the new version configuration.
-
Use "NSFileManager.replaceItemAt(_:withItemAt:backupItemName:options:)" to (safely) replace the old app bundle with the new one.
When I want launch application, I have error "App” is damaged and can’t be opened. You should move it to the Bin." . Although I can permit app opening in Settings, it occurs after every update, so it can be annoying to user.
The first step here is to determine what exactly the system doesn't like. The mostly culprit is the file quarantine xattr. You can check for it using:
xattr -l <path>
and you can remove it by running:
xattr -d com.apple.quarantine <path>
Note that you'll need to remove it from all of the files in your app bundle.
My guess is that removing it will allow your app to launch without issue, but if that DOESN'T work the the issue is with the data you're actually writing out in the update.
Assuming this is a quarantine issue, then that leads to a few more questions:
__
Kevin Elliott
DTS Engineer, CoreOS/Hardware