iOS In-App Purchase - Authentication Failed - There was a problem with the app store - in-app-purchase

Everything working fine using RevenueCat in Google purchasing and Apple sandbox. But in production mode (iOS 14 and Xcode 12) I got the below error on trying to make a purchase.
[Purchases] - DEBUG: PaymentQueue removedTransaction: agfpro3m (null) ((null) Error Domain=SKErrorDomain Code=0 "An unknown error occurred" UserInfo={NSLocalizedDescription=An unknown error occurred, NSUnderlyingError=0x282604db0 {Error Domain=ASDErrorDomain Code=500 "Unhandled exception" UserInfo={NSUnderlyingError=0x282604c60 {Error Domain=AMSErrorDomain Code=100 "Authentication Failed" UserInfo={NSLocalizedFailureReason=The verify credentials call failed., NSLocalizedDescription=Authentication Failed, NSUnderlyingError=0x2826048a0 {Error Domain=AMSErrorDomain Code=0 "Authentication Failed" UserInfo=0x283c84380 (not displayed)}}}, NSLocalizedFailureReason=An unknown error occurred, NSLocalizedDescription=Unhandled exception}}}) {
NSLocalizedDescription = "An unknown error occurred";
NSUnderlyingError = "Error Domain=ASDErrorDomain Code=500 \"Unhandled exception\" UserInfo={NSUnderlyingError=0x282604c60 {Error Domain=AMSErrorDomain Code=100 \"Authentication Failed\" UserInfo={NSLocalizedFailureReaso
2020-10-15 09:36:10.504 [info][tid:com.facebook.react.JavaScript] [Error: There was a problem with the App Store.]
My app was rejected and they say the following.
We found that your in-app purchase products exhibited one or more bugs when reviewed on iPad running iOS 14.0.1 on Wi-Fi.
Specifically, there was an issue with the In app Purchase. We could not complete the purchase as we encountered a bug.
Next Steps
When validating receipts on your server, your server needs to be able to handle a production-signed app getting its receipts from Apple’s test environment. The recommended approach is for your production server to always validate receipts against the production App Store first. If validation fails with the error code "Sandbox receipt used in production," you should validate against the test environment instead.
Anyone already faced this issue?
Thanks!!!!

This happened to my setup because the account I was trying to sign in with wasn't registered as a Sandbox Tester.
When testing out purchases locally, you are always working in the sandbox. You must set up a sandbox tester for this to work properly.

SKError code 0 is an "Unknown" error from Apple: https://developer.apple.com/documentation/storekit/skerror/code/unknown
If this happened to the reviewer during app review, there's nothing you can do on your end to resolve it. I'd try submitting the same binary or you can try explaining the situation to the reviewer.

This is a bug on Apple side. Mine works on iPhone SE 2(private phone), but not on iPhone 11. Both run the same iOS version.
I think Apple is unable to verify that the epost you are using, belongs to you.

Related

Why does TestFlight throw error: "Could not install..."

After uploading the app I can't install it. I get the following
error: "Could not install MY_APP_NAME. The requested app is not available or doesn't exist".
What might cause this issue and how can I fix it?
Things I tried:
Rename the app
Recreate certificate and provision profile
Reinstall TestFlight on the device
From the device logs, I see the next TestFlight issue:
"Cannot get app record for BundleID MY_APP_BUNDLEID: The operation couldn’t be completed. (OSStatus error -10814.)"
I provided the correct bundle id, otherwise, I cannot be able to upload the app to TestFlight.
Apple support got back to me. A night later issue has gone. I don't have any details about it, it is just gone. Seems like it was an issue on TestFlight side.

Apple AppStore Sandbox renewable subscription purchase not succeeding

The issue is occurring in a setup where target Xcode scheme StoreKit configuration is set to None and on standalone ipa builds. Hence real remote AppStore sandbox is used.
Upon subscription attempt both on iOS & tvOS across vast version range we've identified following errors occuring:
Error Domain=SKErrorDomain Code=0 "Cannot connect to iTunes Store" UserInfo={NSLocalizedDescription=Cannot connect to iTunes Store}
and
Error Domain=SKErrorDomain Code=0 "An unknown error occurred" UserInfo={NSLocalizedDescription=An unknown error occurred, NSUnderlyingError=0x28039b6f0 {Error Domain=ASDServerErrorDomain Code=5008 "Sign in to view account information." UserInfo={NSLocalizedDescription=Sign in to view account information.}}}
and
<SKPaymentQueue: 0x280f1fa10>: Payment completed with error: Error Domain=ASDErrorDomain Code=500 "Unhandled exception" UserInfo={NSUnderlyingError=0x2803a4720 {Error Domain=AMSErrorDomain Code=301 "Invalid Status Code" UserInfo={NSLocalizedDescription=Invalid Status Code, AMSURL=https://sandbox.itunes.apple.com/WebObjects/MZBuy.woa/wa/inAppBuy?REDACTED, AMSStatusCode=500, NSLocalizedFailureReason=The response has an invalid status code}}, NSLocalizedFailureReason=An unknown error occurred, NSLocalizedDescription=Unhandled exception}
We have not identified any change in our code causing this. Old builds which used to work now experience this issue.
The culprit turned out be our Appstore Connect configuration of our subscriptions.
In the subscription config, there was a warning issued that we do not have App Store Localization.
The bug(?)/requirement in Apple Sandbox must be a fairly recent change introduced around July/August 2022. The very same configuration was working flawlessly for us before.
This is the App Store connect state BEFORE the Localization missing config fix was added:
and after it was added:
After adding this sandbox subscriptions started working normally immediately.
Do not forget removing the app from the device before performing any further testing.

IOS HealthKit Error:Error Domain=com.apple.healthkit Code=4 "Missing com.apple.developer.healthkit entitlement

I'm taking out the HealthKit capability from my IOS app (Xcode 8.3.3, swift 3, IOS 10.2). I edited the app ID and turned off the HealthKit Service In developer account and created a new provisional certificate for signing that goes with this app ID. I've also turned off the HealthKit switch in Xcode capabilities, I verified there is nothing in the info.plist associated with HealthKit.
But I still get this error:
Error Domain=com.apple.healthkit Code=4 "Missing com.apple.developer.healthkit entitlement." UserInfo={NSLocalizedDescription=Missing com.apple.developer.healthkit entitlement.}
Greatly appreciate if you can please guide me how to resolve this issue.

Token Issue with Firebase

Whenever I run my app (powered by Firebase) in the iOS Simulator, I get multiple warnings printed out in the console:
<FIRInstanceID/WARNING> Error failed to delete all GCM tokens from keychain Error Domain=com.google.iid Code=-34018 "(null)"
<FIRInstanceID/WARNING> Error unable to save iid-token to keychain Error Domain=com.google.iid Code=-34018 "(null)"
<FIRInstanceID/WARNING> Failed to fetch default token Error Domain=com.firebase.iid Code=502 "(null)"
However, if I run the app on a device, I have no issues, and it works as expected. Upon further research, I found that the problem may exist with Firebase Cloud Messaging (FCM). After I found this out, I went to the GoogleService-Info.plist and I set the key IS_GCM_ENABLED to NO. However, this did not solve my issue.
I figured out a solution for this issue. It turns out that there is a keychain bug with Xcode 8. To resolve this issue, I enabled my app's KeyChain Sharing in the Capabilities section. I hope this helps anyone with the same issue.

Impossible to fetch SKProducts in App extensions?

SKProductsRequest always fails in my Action Extension, with this error:
Error Domain=SKErrorDomain Code=0 "(null)"
It works fine in the main app.
Is it a deliberate limitation?

Resources