Testing Mac App Store application receipt validation is frustrating

Because the receipt file doesn't exist at the following path, my application exits with error code 173.

/Applications/Notched Up.app/Contents/_MASReceipt/receipt

However unlike in the past where it then re-launches and works, I'm now getting the error message that this application is damaged and must be re-downloaded from the App Store.

In the console I see the following messages.

error	12:35:02.553477+0800	Notched Up (com.apple.libsqlite3)	cannot open file at line 45340 of [d24547a13b]
error	12:35:02.553498+0800	Notched Up (com.apple.libsqlite3)	os_unix.c:45340: (2) open(/var/db/DetachedSignatures) - No such file or directory
default	12:35:04.481080+0800	storeuid (com.apple.commerce)	Fetching missing receipt for sandbox app /Applications/Notched Up.app
default	12:35:04.707374+0800	storelegacy (com.apple.commerce)	StoreLegacy: Failed to perform in-line receipt renewal for application at path /Applications/Notched Up.app : 'Error Domain=com.apple.commerce.client Code=500 "(null)"'

My gut is telling me that something internal related to the App Store isn't working correctly as this code was functional a couple of weeks ago and while the first two lines show sql, this app doesn't use sqlite.

  • App is signed with "Apple Distribution".
  • Have tested app with "Apple Development".
  • Have removed entitlements that need a profile and the provisioning profile.
  • The App Store application shows the correct "Sandbox" tester account (in the preferences).
  • I've logged the test account out and back in.
  • I've verified that tester account is the same store locale as my main account.
  • I've rebooted this i9 16" MBP running macOS 12.0.1, even thought it rebooted itself last night, because ????

Any advice, can you spot something I've done wrong?

Accepted Reply

I have been able to get SKReceiptRefreshRequest working, but it's a PITA because it is asynchronous, so it can pop-in while the user is working in the app, which means you can't just terminate any more and must think of how to handle the app's flow for the App Store DRM.

  • Hi, thanks for the update. I've tried to remove every request for the receipt on my app (mine is made on Unity, so I can't guarantee that there are no other embedded calls from Unity's side or a native plugin), but still the same crash on the startup. I am even considering submitting the app without testing to the AppStore, activating manual release and testing using promocodes before the release. At least, in this case, the receipt will come from the AppStore and embedded on the download, so no AppStore sandbox environment. But I am not sure the reviewers would be able to test it anyway.

    I have a feeling that the error is related to Apple's certificate chain as I see too many errors on the system/console logs that has to do with codesign and other trust processes. I've checked all certificates on the keychain and all of them are valid anyway. But I believe it is related to it. I've learnt way more about codesign than I would like hehe.

  • I am sorry that I am not able to assist with Unity as I've never used it to develop Mac Apps. It may be that there are other issues as well, is your application using a provision profile? If so, you may need to use the "Apple Developer" certificate (and matching profile) to test all the App Store functionality, then re-sign the application using the "Apple Distribution" certificate (and matching profile) to submit. In regards to the error I was getting, instead of using "exit( 173 )", instigating a SKReceiptRefreshRequest object, setting up a delegate to handle the response, was the only way I was able to get a valid receipt and avoid the "Application is damaged" error. It is a pain because I've had to also re-write how the DRM logic works, because SKReceiptRefreshRequest is asynchronous, so it might fail while my app is already running and the user is working. I don't want to make the user wait, because it might take a long time and that too creates user frustration.

  • Hi @rowlands. Thanks for the kind answer. Actually being Unity doesn't change much, I've implemented all the native side for the AppStore, but removing it wasn't enough as the app still crashes and shows the same logs, so maybe the Unity's player has the logic to request the receipt too. The profiles and certificates are all setup, the app exists and uses AppStore since 2012, from 2012 to Nov/2021 I've had no problems at all, just now. Nothing expired, so it can't be on my side at all. Even this new update didn't change anything from code to the development tools. Next week I will try to create a blank project, just add codesign and see how it goes. I am not very optimistic as I saw on the other thread that people tried that with no success. The silence from Apple is disturbing, no answer to the bug reports, no comments on the forum. Sad, Apple treats the developers very badly, has always been like that with poor tools and support, if it wasn't the developers finding out workarounds, AppStore would be empty I guess. Thanks again and have a nice Sunday.

Replies

It's not working for many developers.

  • Thanks @Schubert. Several others in other forums have also commented that it hasn't been working in the last few weeks for them, some are even saying that App Store reviewers are rejecting apps because of this problem.

    I was hoping that I was doing something wrong and I could fix it at my end.

    Would be nice if Apple could make a statement, at least let us Mac developers know what's going on and when it might be fixed.

Add a Comment

Same here, I am going nuts. A whole day seeing the error, resetting everything and nothing new. Thank for this post, at least I am not alone.

Mac Sandbox environment has always been terrible with invalid receipts or insanely long merged ones, but this time the deserve a trophy.

Hope they fix it soon, I can't update my app for Mac due to it.

  • Thank for this post, at least I am not alone.

    You're welcome and thank you joining in. In other forums there's other developers with the same problem. One developer was saying that App Review was rejecting their application because of this issue, and the developer got around it by removing the receipt validation code (which in the past has been a reason for rejection).

    I was really hoping that someone from Apple would chime in and tell me if I was doing something wrong, to use a different API or that Apple is looking into this. In comparison, FastSpring respond to support requests within 24 hours.

  • Hi @rowlands, thanks for the info. I really don't know what to do, I may try to remove the refresh receipt but I am not sure if it will affect the error as I see no log from my app requesting the receipt before the crash. It seems it starts automatically from the launch process and the error would be on Apple's server side . As you've posted before, there is this error 500. I've check all possible logs from Mac and got these too:

    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.)’

    I've been doing the same process since 2012, even if the AppStore sandbox is bizarre, the login window has always been shown and the app relaunched.

    I don't know how to escalate the error to Apple support/devs. By far Apple is the company that treats developers worse.

    Thanks again. If you find out something, please, update here. I will do the same.

Add a Comment

I have been able to get SKReceiptRefreshRequest working, but it's a PITA because it is asynchronous, so it can pop-in while the user is working in the app, which means you can't just terminate any more and must think of how to handle the app's flow for the App Store DRM.

  • Hi, thanks for the update. I've tried to remove every request for the receipt on my app (mine is made on Unity, so I can't guarantee that there are no other embedded calls from Unity's side or a native plugin), but still the same crash on the startup. I am even considering submitting the app without testing to the AppStore, activating manual release and testing using promocodes before the release. At least, in this case, the receipt will come from the AppStore and embedded on the download, so no AppStore sandbox environment. But I am not sure the reviewers would be able to test it anyway.

    I have a feeling that the error is related to Apple's certificate chain as I see too many errors on the system/console logs that has to do with codesign and other trust processes. I've checked all certificates on the keychain and all of them are valid anyway. But I believe it is related to it. I've learnt way more about codesign than I would like hehe.

  • I am sorry that I am not able to assist with Unity as I've never used it to develop Mac Apps. It may be that there are other issues as well, is your application using a provision profile? If so, you may need to use the "Apple Developer" certificate (and matching profile) to test all the App Store functionality, then re-sign the application using the "Apple Distribution" certificate (and matching profile) to submit. In regards to the error I was getting, instead of using "exit( 173 )", instigating a SKReceiptRefreshRequest object, setting up a delegate to handle the response, was the only way I was able to get a valid receipt and avoid the "Application is damaged" error. It is a pain because I've had to also re-write how the DRM logic works, because SKReceiptRefreshRequest is asynchronous, so it might fail while my app is already running and the user is working. I don't want to make the user wait, because it might take a long time and that too creates user frustration.

  • Hi @rowlands. Thanks for the kind answer. Actually being Unity doesn't change much, I've implemented all the native side for the AppStore, but removing it wasn't enough as the app still crashes and shows the same logs, so maybe the Unity's player has the logic to request the receipt too. The profiles and certificates are all setup, the app exists and uses AppStore since 2012, from 2012 to Nov/2021 I've had no problems at all, just now. Nothing expired, so it can't be on my side at all. Even this new update didn't change anything from code to the development tools. Next week I will try to create a blank project, just add codesign and see how it goes. I am not very optimistic as I saw on the other thread that people tried that with no success. The silence from Apple is disturbing, no answer to the bug reports, no comments on the forum. Sad, Apple treats the developers very badly, has always been like that with poor tools and support, if it wasn't the developers finding out workarounds, AppStore would be empty I guess. Thanks again and have a nice Sunday.

no answer to the bug reports, no comments on the forum.

To be clear, neither of these are actually support channels (the former is a community-focused best effort and the latter is for feedback). If you want official support, I recommend that you open a DTS tech support incident.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

  • Hi Eskimo, thanks for the comment. We know that, the reason we are posting everywhere, including bug reports and all other support channels, is because it is an issue that repeats from time to time and that creates a lot of chaos for Mac devs. The forum has shown itself so important to find out workarounds or, at least, in my case, to not feel alone. Again, thanks for the support and for indicating what you believe is the best way to go. I will try it. Thanks.

  • @eskimo, is there someone I can write to? I believe that this is a perfect example of why Apple should reconsider how they utilize their forums. Many other companies use their forums for support and to triage bugs and issues. These receipt failures, makes it hard (for those that do) to test everything before submitting to the App Store, let alone the poor dev who got rejected and couldn't even debug their receipt validation code (on a different forum). DTS is great for one-to-one (and includes some truly awesome people, present company included), but in situations like these, the problem affects multiple developers and it might actually be more efficient for Apple to say something on a public searchable forum, than answer multiple DTS tickets all of the same (providing developers file DTS tickets and don't just give up). The easier and quicker it is for developers to find solutions, the less resources they'll need and the less frustrated they'll get. Please understand this is not a knock on you or the great people like yourself who assist others here (I do hope that Apple pays you to 'watch' the forums), its about Apple controlling how developers can distribute their apps, but at the same time make it harder to do so, which is incredibly frustrating for those, especially those who were enthusiastic about building great apps for the Mac platform. Thanks for all your help over the years Quinn, I wish you a Merry Christmas and a happy new year. I also hope that one day I can truly express my gratitude. Sam Rowlands.

  • Just FYI @eskimo - I filed a DTS incident on November 16, 2021 (786198789). They told me to file a bug report which I did (FB9766203). Although all the needed information is in the bug report, no further response. When I followed up with the DTS team afterwards, I received: "Engineering just contacted you for more info on this feedback. Please continue to track the problem via the bug report. This TSI is now closed."

    There appears to be no way to escalate the issue w/ Apple anywhere, and I have not been able to get a receipt for 6 weeks now.

Add a Comment

Has anyone solved the problem? I haven't been able to test my app for almost a month now.

It seems that receipt refresh in the sandbox environment has been fixed by Apple since the release of macOS 12.2. It also works on macOS 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.

Add a Comment

Same issue here. Just want to test a MAS sandboxed app. This is Xcode 13.4.1 and macOS 12.4. I'd hoped the potential fix in macOS 12.2 solved it but apparently not. I really don't need StoreKit, so calling SKReceiptRefreshRequest isn't attractive unless no other workarounds appear. What is everyone doing?

Same problem

I don't see a solution posted for this. I am unable to run a Unity-based app that works on Android and iOS, as a Mac version. I just wish to run it only local MAC It builds just fine but each time I go to run it, it reports Failed to validate Mac Appstore receipt. But this is not an app in the App Store.