Pragmatism in the real world

Damaged application error when developing for Mac

I’ve been doing a few updates to Daily Jotter, my little Mac app that’s available in the Mac App Store. It’s been a little while since I last updated it and a few things have changed.

After updating the code to fix deprecation warnings, my immediate problem was that the debug version of the app wouldn’t start up and I see this error.

2024-07-25-dj-damaged.png

I know this error well. It means that my app has exited with an error code of 173 which means that it could not validate the store receipt.

Digging through the code with the debugger, I find that this is happening because there’s no receipt file to validate. Strange!

What I expect to happen is that on exiting with 173, Xcode/macOS will ask me to sign in as a test user, it then generates a test receipt file and relaunches my app automatically. My app then validates and I get on with development and testing.

Except that this wasn’t happening.

Time to open Console.app and see what’s going on. I quickly discovered this log entry:
storekitagent: Failed to renew receipt for exit(173): Error Domain=ASDServerErrorDomain Code=500317 "Unhandled exception" UserInfo={NSLocalizedDescription=Unhandled exception, NSLocalizedFailureReason=An unknown error occurred}

The lovely thing about a specific error code is that you can google it! It doesn’t take me long to find my problem: A real user is logged into the test account!

To solve the problem

  • Head to the App Store and open Settings.
  • At the bottom, you’ll see Sandbox Account with the email address of the user which will be used for testing:
    2024 07 25 invalid test user.

    In my case, this was a real user, not a test one.

  • Click Sign Out
  • Sign in with your test account

Once I had the correct test account in here, I cleaned the build folder in Xcode, re-ran the app and it all worked.

Simple when you know what the problem is. Thank goodness for logs with unique messages that we can search on!

Thoughts? Leave a reply

Your email address will not be published. Required fields are marked *