Mac App Store: "***.app" is damaged and can't be opened - macos

We do receive customer support request for our Mac App Store version where they report only getting an alert "Appname" is damaged and can't be opened. Deleting the app and downloading it fresh from the Mac App Store doesn't solve the problem. A reboot of the system seems to help, but the error seems to reappear after some time.
Mac App Development: "***.app" is damaged and can't be opened is unrelated as it is about development and/or testing of an app. This also seems to break on every uneven macOS release.
So far we where not able to find a common cause for this Mac App Store issue.
We are using receipt validation code from Apples Receipt Validation Programming Guide.

Exit If Validation Fails in macOS
If validation fails in macOS, call exit with a status of 173. This exit status notifies the system that your application has determined that its receipt is invalid. At this point, the system attempts to obtain a valid receipt and may prompt for the user’s iTunes credentials.
If the system successfully obtains a valid receipt, it relaunches the application. Otherwise, it displays an error message to the user, explaining the problem.
Do not display any error message to the user if validation fails. The system is responsible for trying to obtain a valid receipt or informing the user that the receipt is not valid.
So it seems the receipt validation fails on a valid receipt and the app calls exit with a status of 173. The system successfully obtains a receipt, it relaunches the application, and again the app calls exit with a status of 173.
Now we are presented with the "Appname" is damaged and can't be opened. alert.
Note that the system seems to cache this result, after double 173 exit, no further launch will be attempted when you double click the app, it will just show the alert again.
The reason for the receipt validation error appears to be a missing MAC address (computer’s GUID).
Without a changelog or tech note it is hard to tell exactly, but based on the Wayback Machine it seems that Apple added new Validating Receipts on the Device sometime around Sept 2021. The new code does seem to address the issue.
Compared with the code from the legacy documentation, the new code is does not only look for build-in en0, but also falls back to en1 or non-build-in en0.

Related

What does the console record "... kernel[0]: AppName[a number] Unable to quarantine: 1" mean?

Lately, I have been trying to sandbox one of my Cocoa apps.
Other things are fine, except that I keep getting the information as in the title in the console for my app.
The record seems to appear at the moment of my file read/write operation. But those operations all succeeded.
What does this record mean? Can I afford to ignore it?
as you are writing executable files, Gatekeeper has it's eye on it. because the files come from a trusted source (the signed and sandboxed app) you can ignore these messages. see documentation on sandboxing

Trigger "application quit unexpectedly" popup when OS X deamon crashes

I'm working on a new OS-X Daemon process (run from launchd) and would like to get popup window every time it crashes with all relevant information (pid, path to crash file, etc...). This will sure help my debugging effort in this early stage of the development.
Basically, i want to have the same behavior as a UI application. For example :
I've made some research and found out about the CrashReporter, but i don't know how to register my app to this service. But it seem like there's no way to trigger popup windows from this service, since crashes are system level events and apps have zero interaction with those.
Maybe there's a way to do so by setting up some parameters in app bundle or via Info.plist ?
EDIT: looking at the crash report manual, it looks like the unexpected dialog works only on GUI user mode, and not on daemon that runs from launchd. perhaps i'm missing something ?
In addition, if the program that crashed is running as a logged in GUI user, CrashReporter will present the user with a dialog asking them whether they want to submit a bug report to Apple (see Figure 1). If the user clicks the Report button, CrashReporter displays another dialog that shows the details of the report (see Figure 2) and allows them to comment it before submission.
I've read that Developer option enable in addition to application crashes, crashes are also displayed for background and system processes. but unfortunately i doesn't work for me.
thanks
Seems like the problem occurs since my background process runs under root privilege, and root privilage process (not just daemons) cannot initiate any UI widget on the screen.
I guess that the only way to deal with it, is by catching the signal that trigger the crash, and send details for a proxy process that run on non-root mode and can initiate the UI dialog box with crash details.
I would be happy to hear for better proposals.
Since CrashReporterPrefs, which allowed you to enable this behavior for daemons, no longer comes with developer tools, you can change the behavior to show the dialog for daemons by running this command in the Terminal:
defaults write com.apple.CrashReporter DialogType Developer

Mac StoreKit "An unknown error has occured" on purchase

Im trying to test my in app purchases in mac osx application as always.
But something happened today and i cant test a single in app.
First i add my payment to SKPaymentQueue,
When it asks - i enter the test user account,
Then i press yes in confirmation dialog,
And after that i just get strange dialog box saying "An unknown error has occurred" with buttons "cancel" and "retry".
When i press "retry" - literally nothing happens.
No absolutely no logs in system console, no changing in SKPaymentTransaction status.. nothing.
Transaction status stays in SKPaymentTransactionStatePurchasing state until i press "cancel" in that strange dialog.
And only after that i get SKPaymentTransactionStateFailed (because it is canclled)
I have tried the other mac, i tried other application (even one that is live and was tested fine like 5 days ago), i tried to create new test user, regenerate app id, provisions and etc.
I have deleted system caches, NetworkInterfaces.plist and did other stuff that i found in google as possible workaround.
What do i do?
For you, this is probably not true, but I'll write for others. In iTunes Connect will likely have InApp-Purchase does not fill in the localization data

Reading desktop pictures in sandboxed app

I'm having crashes in my sandboxed app related to reading desktops pictures which I can not reproduce on my Mac but I got rejected on the App Store for it crashing and other users have reported crashing.
The desktop pictures are being read from "/Library/Desktop Pictures" or using NSWorkspace's desktopImageURLForScreen method. These work just fine on my Mac but I'm a little confused because I don't know how I'm getting access to "/Library/Desktop Pictures" without the directory being chosen manually in an NSOpenPanel. As for desktopImageURLForScreen I'm not sure if this is sandbox safe depending on where the file is stored on that users screen.
Can anyone verify these 2 methods for getting the desktop picture are safe in all cases or do I need to request the user select the directory where the desktop pictures are stored (even from desktopImageURLForScreen) in a NSOpenPanel?
First, having the sandbox deny access to a URL does not cause a crash - methods will return error indications. So if your app is crashing it is either because you cannot access the URLs, or because you are not testing correctly for failure.
If you wish to quietly access desktop images you can specify the com.apple.security.assets.pictures.read-only entitlement - this will give your app access to common image locations. It does not guarantee that your app can access the URL of the desktop image, just increases the probability. So you must still test for success or failure.
If your program requires access and if silent access fails you can then put up a standard file dialog; with suitably customised prompts, buttons, etc; to request the user grants access to the URL.
HTH

WP7: Edit Screenshot While App is Backgrounding (Mango)

I have an app that I have been developing that can display sensitive user data.
When the user backgrounds the app, the OS appears to take a screenshot of the app as it was running, and displays it so when the user returns, their state is restored.
I am trying to prevent the user's information from being seen in this screenshot.
My initial idea was to display a Popup of my splash screen image, but it does not seem to render it in ApplicationDeactivated. Is there any other way you might accomplish this?
I am not sure you are analyzing this correctly. I don't see how the OS could take a screenshot of an app and use that to restore state. Also, if it was true that the OS did that, Tomb Stoning wouldn't be such a big issue in the requirements for an app in the submission process. A dev needs to handle grabbing and saving state on exit and reloading it on start-up again.
If you didn't code this tomb stoning, are you using a frameowrk that has built in support for this? You could disable the tombstoning so certain pieces of information are not stored, and in fact if this data is that sensitive you should make sure it isn't saved. But, if you save it make sure you encrypt it so nothing else could examine the saved state. Although, that shouldn't be possible on Win Phone as the OS is supposed to enforce the boundries between apps.
Received a response from Microsoft which indicates that this is not possible in the Mango SDK; it may be added into future releases of the platform.

Resources