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:
- cry
- restart the computer
- delete
~/Library/Caches/com.apple.appstore
- create a new sandbox user
- try with an old sandbox user created years ago.
- reinstall Xcode
- log out of App Store and iCloud + restart the computer again.
- killed the storeaccountd daemon + restart.
- confirmed that the version and the bundleID on Info.plist are the same as in appstoreConnect.
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?