I have tested all solutions on similar questions on SO and they all failed for me.
I think mine is different because the application's receipt is not even loading.
I am having developing this macOS app for at least 7 months. The app contains Auto-Renewable Subscription.
Since day one, I am retrieving and validating its receipt with success. No problem at all. That were the good days.
January 3, 2020, I started working on the app again.
Since then, the app fails miserably to even load the receipt. No change in code, nothing.
Even a simple code like this, that is copied from Apple, fails.
// Get the receipt if it's available
if let appStoreReceiptURL = Bundle.main.appStoreReceiptURL,
FileManager.default.fileExists(atPath: appStoreReceiptURL.path) {
do {
let receiptData = try Data(contentsOf: appStoreReceiptURL, options: .alwaysMapped)
print(receiptData)
let receiptString = receiptData.base64EncodedString(options: [])
// Read receiptData
}
catch { print("Couldn't read receipt data with error: " + error.localizedDescription) }
} else {
exit(173)
print("this error stinks!")
}
this line
FileManager.default.fileExists(atPath: appStoreReceiptURL.path)
fails miserably. The receipt is not there.
This is what I have tried so far:
~/Library/Caches/com.apple.appstore
Everything I get is
networkError(error: Error Domain=SKErrorDomain Code=0 "(null)")
exit(173)
is triggered, I type the sandbox user then I get
The app is damaged and can’t be opened. Delete the app and download it again from the App Store.
I have had this problem on an iOS device application I was developing 10 years ago and the only way I have managed to solve that was by resetting the device to factory default. Sincerely, I will not reinstall macOS.
I am desperate. I have aged 20 years in the last couple of days.
Is there some cache or macOS service that might be clogged?
One thing I have noticed is that the box the pops to type the App Store credentials do not show the words sandbox
as the boxes the pop when you try to buy the in-app purchase and that this boxes always comes pre-filled with an old sandbox user. Is there a way to clean that?
Any other ideas?
I have opened a technical incident with Apple and they were unable to solve that.
Someone suggested me the only thing that solved the problem: to create another user on the same Mac and test it from there.
PROBLEM SOLVED
If you are having this problem from iOS, the solution is to reset the device to factory defaults.
Note: apparently, this time, the whole problem was caused by Apple, after a half cooked update to their sandbox/production servers.