Code 173 no longer triggers receipt generation

My macOS application exits with code 173 when the Mac AppStore receipt validation fails. This used to trigger a system dialog that allowed me to enter test user credentials which then created an AppStore receipt. Now this behaviour changed to just showing a dialog stating that the application is damaged and needs to be redownloaded from the AppStore. This makes it impossible for me to test receipt validation for my app.

What might have caused this change in system behaviour? I'm even getting this "damaged application" dialog when I delete the "_MASReceipt" folder from third party applications when I'm pretty sure that before it also showed this dialog that allows to enter AppStore credentials and recreate a valid receipt.
  • App receipt generation is broken. I'm getting this message on macOS Monterey 12.3.1 with Xcode 13.3.1. What can be done?

    “My App” is damaged and can’t be opened. Delete “My App” and download it again from the App Store.

  • +1, filed a duplicate feedback FB10014055 

  • Same issue for me. Started immediately after Mac Software Update installed Command Line Tools 13.4. Still running Xcode 13.3.1 and tried rolling back to command tools for 13.3.1. Didn't help :( Apple!!! Dang it

Accepted Reply

This thread has been deleted

It's now working again.

  • Confirmed on 10.15

  • Yes, it also working on BigSur 11.6.1 I have logged a bug and open a technical support incident, after the communication they updated the bug FB9848384 with Resolution: Potential fix identified - in macOS 12.2. 

  • Also now working for me w/ 10.15 and 11.6. Interestingly though, there has been a change in behavior because there is no prompt to log in using the sandbox user id credentials in either Big Sur or Catalina. (Am also logged out of the App Store). So no authentication at all - it looks like they just opened up the receipt processing altogether.

Add a Comment

Replies

I have the same problem, also the code:

Code Block
NSBundle *mainBundle = [NSBundle mainBundle];
NSURL *receiptURL = [mainBundle URLForResource: @"receipt" withExtension: @""];
receiptData = [NSData dataWithContentsOfURL: receiptURL options: NSDataReadingMappedAlways error: &theError];

crashes without logging any errors in the console pane in XCode or the console when I use the dataWithContentsOfURL method and then I start to get all of the application is damaged alerts.

How can you test your receipt validation code with this bug? You should file a bug report. Also there are other threads about this.
It's working again (without me having done anything). So I guess this was a fluke in the AppStore.

This appears to be randomly happening again. Curious if anyone else has been experiencing this problem lately. Found the following related logs in the Console:

default    15:39:49.352585-1000    storeuid    <StoreKitClient: 0x7f8898d2d820>: Using active account. Sandbox: 1, receipt exists: NO, receipt is stub: NO
default    15:39:49.354734-1000    commerce    storeuid[552] starting request app-receipt-create
default    15:39:49.455240-1000    commerce    <CKStoreRequest: 0x7f94a1f64e10> https://p100-sandbox.itunes.apple.com/WebObjects/MZFinance.woa/wa/createAppReceipt
default    15:39:49.877166-1000    commerce    StoreSession: StatusCode: 200; <private>; Environment: SB-MR; URL: https://p100-sandbox.itunes.apple.com/WebObjects/MZFinance.woa/wa/createAppReceipt
error    15:39:49.879812-1000    storeuid    <ReceiptRefreshRequest: 0x7f889a1616e0>: No receipt data in response
error    15:39:49.879883-1000    storeuid    <ReceiptRefreshRequest: 0x7f889a1616e0>: Error fetching receipt for X - Error Domain=com.apple.commerce.client Code=500 "(null)"
default    15:39:49.880675-1000    storelegacy    StoreLegacy: Failed to renew receipt for application at path X : 'The operation couldn’t be completed. (com.apple.commerce.client error 500.)'
error    15:39:49.930396-1000    diagnostics_agent    Invalid receipt [0 bytes]
  • Confirm happening for me *** well with the same commerce code 500

  • I have the same problem. Do you create an _MASReceipt folder in the XCode build settings or is the store supposed to do this when you call exit(173)? I can't find where this is documented. I don't see any errors logged in XCode or my Console.

  • When you run the app and the receipt is not present, it is supposed to prompt you with a login dialog so you can enter your sandbox account's email and password, and then it will generate a receipt and put it in the _MASReceipt folder for you. Except right now it looks like receipt generation is broken so the _MASReceipt folder never gets populated with a receipt, and you get an error saying your application is damaged and can't be opened.

Apple broke this. All developers have the same problem. It's probably not a bug in XCode, more likely would be macOS 12.0.1 Monterey or the App Store. You won't be able to build your app with receipt validation until they fix this - probably in the next update of Monterey.

Again this is no longer working for me. Am I alone with this problem or can anyone else confirm this?

I updated to the release candidates of Monterey 12.1 and Xcode 13.2 and the problem persists. One would think this should be a top priority issue.

  • I can confirm that Monterey 12.1 and Xcode 13.2 final versions didn’t fix it, either. There are feedback assistant reports regarding this issue, so Apple is at least aware of it. Please consider boosting their priority by filing your own bug report with references to them: FB9780730 FB9755646

  • It's not even working in Big Sur any more. I filed a duplicate report at FB9808700

    Escapes me how Apple can linger this issue for weeks.

  • Well, the bug is "only" affecting Mac App Store software which traditionally is not the most important thing for Apple. Also, they have other fires to put out...

Dear @eskimo, could you, please, provide us any support for this issue?

I've been doing the same process for the same app for 9 years, same build, sandbox in-app, etc, etc. Now, without changing anything, I am completely blocked with the error described in this thread. I've tried just everything possible, from new certificates, cancelling and recreating all certificates, etc, etc. But nothing, the app closes during startup, log shows:

  • Error fetching receipt for xxxx - Error Domain=com.apple.commerce.client Code=500 “(null)”
  • ‘The operation couldn’t be completed. (com.apple.commerce.client error 500.)’

Then the nightmare message App is damaged ... Instead of relaunching the app asking for the sandbox account login as have always happened.

On this thread and a few others, you can see that there are many developers facing the same situation without any alternatives.

Thanks in advance, Fernando

I'm seeing this again now on macOS 12.3.1. After exit(173), macOS brings up the system dialog for app store credentials, then fails with the message "the application is damaged and needs to be redownloaded from the AppStore" for my Xcode builds, and also for my archived TestFlight builds. Until recently, it would fetch the _MASReceipt automatically without a dialog. Does anyone know what might have changed? Whether this is something I broke? Something on Apple's end? Something in my system? Logging in and out of the app store, rebooting, have no effect.

  • You are right, this is broken again.

  • Same. Busted here. Again.

    Maybe we should all start billing Apple for all the lost hours this has been causing us...

  • Yes, it is back, same s.. I haven't updated MacOS (still 12.2) but the error returned . That's ridiculous.

Is there anything that we can do on our end? I'm facing the same problem.

I'm not prompted for a sandbox user anymore. Somehow the system has remembered the sandbox user. Is there a way to remove the sandbox user-data? Maybe that will help.

Until then: the 500 error is clearly something at the App Store end that is broken. You would think that Apple has monitoring in place on errors happening on their services...

  • I got out of this mess, at least that's what it looks like, for now.

    I was tired of there being no receipt, so I use some preprocessor flags to disable the exit(173)'s I have in my app. I though let's continue with actual coding... So with that out of the way I could at least run my app again. Because my is going to use a subscription model, I tested if subscribing still worked, and it did! So, I was able to subscribe to my app, and for some reason that added a receipt to my app again.

    After turning off the preprocessor flags, the app still works, it sees the receipt.

  • Hhmm. After cleaning the build folder and running again, I am now prompted with the following message: "X will damage your computer. You should move it to the Bin." Apparently, my app is now seen as malware. Don't know if the above "workaround", is the cause of this...

    Anyone seen this problem, and know how to get rid of it?

  • Is there anything that we can do on our end?

    Make sure to file a bug report at https://feedbackassistant.apple.com . There are 1600 developers watching this thread. If many of us file a report, Apple will hopefully notice that this is a significant issue.

    You would think that Apple has monitoring in place on errors happening on their services.

    The last time around I suggested to Apple they include the status of this issue at

    https://developer.apple.com/system-status/

    to not waste their and the developers' time. They decided not to do that since the system status reads "All services are operating normally." Maybe you too can suggest to include this in the system status page in your bug report.

+1 ... Building my app with macOS 12.3.1 (M1) and Xcode 13.3.1, and no receipt is retrieved after exiting with 173. Tried App Store log out / log in (sandbox and regular account) as well as reboot to no avail.

  • Please file a bug report at https://feedbackassistant.apple.com . Mention report IDs FB10003596 FB10007043 FB9831929 so Apple can correlate the issues. Post your report ID here so it can be included in future reports by others.

  • +1 ... Was working February 23, 2002 but now May 12, 2022 it is NOT working again. (Original bug filed November 17, 2021) Updated my report FB9766203 and referenced the report numbers listed above. Have not updated macOS version NOR Xcode version so no changes on my end. But I have since released a new version of the App and am now trying to use my development environment/repository again for the first time since that release.

Add a Comment

This issue started for me today (5/13/22) IMMEDIATELY after Mac Software Update installed Xcode Command Line Tools 13.4. After that ANY MacOS App running in Xcode under does an Exit(173) due to NOT finding any App Store Receipts. I get this message:

“x” is damaged and can’t be opened. Delete “x” and download it again from the App Store.

I am not sure why it installed 13.4 before Xcode 13.4 is released but that is what update automatically installed. I'm on MacOS 12.3.1 (M1) and running Xcode 13.3.1.

I tried rolling back to the 13.3.1 Command line tools but that didn't fix anything.

Only way I can run and develop my mac apps now is to comment out the Receipt check.

Bug report filed - FB10017618

  • Yep, I'm doing the same - commenting out receipt checks. Unfortunately I recently changed IAP processing in my app, and now releasing it is massively delayed as I cannot test properly. What really annoys my is Apple's ignorance with regards to this issue: No official comment in any discussion, no response to my bug report, and the Developer System Status is still reporting everything "green". That sucks...

Add a Comment

It's working again now.

I still wished this was mentioned on https://developer.apple.com/system-status/ whenever it goes down.

  • +1 Thanks for the heads up. Just tried myself again and it's working for me now too. Feels like it's just Apple engineers (accidentally) introducing bugs into the "system" so I doubt they would want to advertise this in any "system-status" page. It's also hard to gauge how many developers a problem like this is actually effecting. Probably not all?

  • Working again without any code change at May 18th, 8:15 pm CEST: obviously Apple has fixed the backend, but no official confirmation of the issue, no response on bug reports, no corresponding system status … Apple, please work on your developer community management.

  • Good it is working again. Terrible that we can't ever trust Apple or their customer service (at least when the customer is the developer). My positive comment is that this forum thread has a lot of nice people. Thanks.

Not working again. No change to macOS version nor Xcode version. Just back to these console messages:

error	11:59:51.470396-0700	storeuid	<ReceiptRefreshRequest: 0x1581c3ee0>: Error fetching receipt for com.moremobilesoftware.divelogdt - Error Domain=com.apple.commerce.server Code=1008 "(null)"
default	11:59:51.471332-0700	storelegacy	StoreLegacy: Failed to renew receipt for application at path /Users/jXXXXXXX/Library/Developer/Xcode/DerivedData/<Product>/Build/Products/Debug/DiveLogDT.app : 'The operation couldn’t be completed. (com.apple.commerce.server error 1008.)'

Anyone else seeing it go back and forth and back and forth like this?