DEV Community

Cover image for SKErrorDomain Code=0. What is it and how to fix it?
Surik Sarkisyan for Qonversion

Posted on • Originally published at qonversion.io

SKErrorDomain Code=0. What is it and how to fix it?

Domain=SKErrorDomain Code=0 “(null)” is one of the more common errors that you may struggle with while processing in-app purchases. This error can occur in both production and sandbox environments and affects the fail to success payment ratio of your app.

Though the reason for this error is more likely to be on the App Store’s side, there still are a few things to try.

In this article, we’ll give you a brief overview of the possible reasons for the error, and what you could test to prevent it from happening.

SKErrorDomain Code=0 in the sandbox environment

When SKErrorCode=0 occurs while in the sandbox environment and not in the production environment, it could be related to issues with the sandbox on Apple’s side and could potentially affect the make payment call and the /verifyReceipt endpoint, although it won’t do this in production mode.

Things you can check:

  • Test your in-app purchases with a real device, not in the simulator
  • Check your in-app Product ID
  • Create a new sandbox test account on the App Store, then logout from all other accounts, and then test it with the new sandbox test account
  • Check whether your in-app purchases are configured correctly on App Store Connect and have the following statuses: Ready to submit or Ready for sale.
  • Check if your app bundle ID matches the bundle ID from App Store Connect where the purchases were created.
  • Add Localisation (Subscription Display Name and Description) to the product. The hypothesis is that there is no obvious way to see this from the error and therefore you may quickly miss it when you are preparing placeholders for future In-App Purchases. However, it seems that Apple should mention this in its documentation and implement an error code that gives a warning about any missing metadata.
  • Reboot/Reset the device
  • Check that you agreed with the latest versions of Apple’s policies

If you have tried everything from the list above, then it means that the issue is on the App Store’s side and you should follow the information on Apple’s status page or submit a bug report.

SKErrorDomain Code=0 during the review process

If you have difficulties during the app review process, then you will have to ask the reviewer to retry the purchase. Also, Apple’s engineers highlight that App Review should not see any issues with sandboxes as they use special accounts for the review process. So if your app was rejected then the issue mostly probably lies elsewhere.

SKErrorDomain Code=0 in production environment

If you receive Error Domain=SKErrorDomain Code=0 “Operation could not be completed. (SKErrorDomain error 0.)” in the production environment, try the following:

Make sure you have used the correct Product Identifier. If you have, then you’ll get error 0 shortly after calling [SKPaymentQueue addPayment:], and before you get the popup asking you to confirm payment.

Try to create a new test user as your current test user might have been invalidated. This can happen if you accidentally log into the App Store with your test user. When this happens, you’ll get error 0 after entering your password to confirm the payment.

Unfortunately, not much else can be done regarding this error while in the production environment. This error mostly comes directly from Apple, and is an unknown error to do with their API. If you are using Qonversion to manage in-app subscriptions, we would also recommend checking our status page for any reported outages. Unfortunately, these errors are returned randomly and directly from Apple.

Submit a bug report about SKErrorDomain Code=0

When the issue is on Apple’s side, it can affect everyone or just some users. It’s always a good idea to submit a bug report with complete information, including a sysdiagnose archive from the device. To submit the bug report, please use Apple Developer Bug Report and follow the instructions. Before you begin, make sure you are familiar with triggering the sysdiagnose log, then follow and perform each step to replicate the problem. When the failure occurs, first, trigger the sysdiagnose profile, then wait 5 minutes before syncing the device with Apple Store and then look for the sysdiagnose archive file. While reproducing the issue, you should take screenshots showing evidence of the connection failure.

We will update this article if and when more details regarding this error become available. If you are getting other Storekit errors, then check out this complete guide on how to handle storekit errors.

Top comments (0)