In-app purchase fail to get receipts and macos says application damaged

I'm developing an application with In-app purchase. After launched, the application will check if receipts exist or not, and will call "exit 173" if receipts not exist, then macos will fetch receipts for application and re-launch it.

When testing the application after a new installation(which means no receipts installed), first i found the application quit quickly after launching(this means exit 173 worked) and then i got error message says "application is damaged, remove it and download again from app store". Just a week ago, the same test was worked, and app store asked user account and password, and launched the application again. But now i can not continue the test.

the following is console log: 17:43:55.505166+0800 storeuid Fetching missing receipt for sandbox app /Applications/Right PDF.app 17:43:55.506797+0800 storeuid <StoreKitClient: 0x7fdc4d75c500>: Using active account. Sandbox: 1, receipt exists: NO, receipt is stub: NO 17:43:55.509601+0800 commerce storeuid[793] starting request app-receipt-create 17:43:55.686252+0800 commerce <CKStoreRequest: 0x7fba2910b830> https://mzstorekit-sb.itunes.apple.com/inApps/v1/receipts/createAppReceipt 17:43:56.031342+0800 commerce StoreSession: StatusCode: 200; ; Environment: (null); URL: https://mzstorekit-sb.itunes.apple.com/inApps/v1/receipts/createAppReceipt 17:43:56.032185+0800 storeuid <ReceiptRefreshRequest: 0x7fdc4e23b660>: Error fetching receipt for com.zeon.RightPDF - Error Domain=com.apple.commerce.server Code=1001 "(null)" 17:43:56.032480+0800 storelegacy StoreLegacy: Failed to perform in-line receipt renewal for application at path /Applications/Right PDF.app : 'Error Domain=com.apple.commerce.server Code=1001 "(null)"'

Does anyone konw what the meaning of the error code:"com.apple.commerce.server Code=1001" or how to resolve it? Thanks for any help.

Can't edit the post, so i put the formatted log message here.

17:43:55.505166+0800 storeuid Fetching missing receipt for sandbox app /Applications/Right PDF.app

17:43:55.506797+0800 storeuid <StoreKitClient: 0x7fdc4d75c500>: Using active account. Sandbox: 1, receipt exists: NO, receipt is stub: NO

17:43:55.509601+0800 commerce storeuid[793] starting request app-receipt-create

17:43:55.686252+0800 commerce <CKStoreRequest: 0x7fba2910b830> https://mzstorekit-sb.itunes.apple.com/inApps/v1/receipts/createAppReceipt

17:43:56.031342+0800 commerce StoreSession: StatusCode: 200; ; Environment: (null); URL: https://mzstorekit-sb.itunes.apple.com/inApps/v1/receipts/createAppReceipt

17:43:56.032185+0800 storeuid <ReceiptRefreshRequest: 0x7fdc4e23b660>: Error fetching receipt for com.zeon.RightPDF - Error Domain=com.apple.commerce.server Code=1001 "(null)"

17:43:56.032480+0800 storelegacy StoreLegacy: Failed to perform in-line receipt renewal for application at path /Applications/Right PDF.app : 'Error Domain=com.apple.commerce.server Code=1001 "(null)"'

Thank you for reaching out, can you please reattempt and see if the issue is resolved?

The Finder is presenting this message after a macOS StoreKit app calls exit (173) a second time. The macOS StoreKit app is being run in the sandbox. The app on launch detects that the appStoreReceiptURL is nil and calls exit (173). The Finder detects this exit result and issue a request to the App Store to write a receipt to the app. This causes the app to present an authentication dialog in which you enter the test user account and password. Normally, the appStoreReceipt is refreshed in the app, but not in this failure case - such that the Finder presents the alert to the effect that "the app is damaged".

For the longest time it was recommended that on launch, the macOS StoreKit app check for the presence of the appStoreReceipt. If not present the app calls exist (173). This is no longer recommended as it rises the Authentication dialog which can be confusing to a user. Instead the advise now is to have the app continue along with the assumption that the user has no access to first time in-app purchase support, or to support for restoring previous purchases.

The fact that the appStoreReceiptURL is a sandbox issue only. In the production environment, when the app is installed from the App Store, there is always an appStoreReceipt. Once a test user makes an in-app purchase the sandbox App Store will write an appStoreReceipt to the app for the app to validate and verify the transaction.

If the goal is to restore purchases on a new launch of the app, and there is no appStoreReceipt, just move along and have the user press a "Restore" button which makes the restoreCompletedTransactions call. On a successful restore of a previous purchase, the appStoreReceipt is also updated.

The StoreKit team asks that macOS StoreKit apps no longer rely on the use of exit(173).

rich kubota developer technical support CoreOS/Hardware/MFI

In-app purchase fail to get receipts and macos says application damaged
 
 
Q