Launch offer for the first 500 accounts: $10K MTR free for 24 months + $100 credit →
    .io
    All App Store and StoreKit fixes
    App Store
    November 16, 2026
    4 min read

    SKErrorDomain Code=0 “An unknown error occurred” (StoreKitError.unknown)

    SKErrorDomain Code=0 (or StoreKitError.unknown in StoreKit 2) only says StoreKit failed without a specific reason. The real cause is in the underlying error. Log NSUnderlyingError. An HTTP 500 or AMSErrorDomain means Apple's servers, usually the sandbox, so check Apple's status and retry later. A message about a UI anchor or scene means your app gave StoreKit nothing to present from. Otherwise, check the Paid Apps Agreement and product setup.

    Symptom

    • A purchase or product request fails with:
    Error Domain=SKErrorDomain Code=0 "An unknown error occurred"
    
    • In StoreKit 2, product.purchase() throws StoreKitError.unknown.
    • It's often intermittent: the same purchase works on a retry, or fails for one sandbox account and not another.
    • React Native and Flutter libraries report it under a generic "unknown" error code.

    Why it happens

    Apple documents SKError.unknown only as an unknown or unexpected error. It says to read the underlying error, and that retrying may resolve it in some cases. In practice, the underlying error points to one of these:

    Cause How to tell
    Apple's sandbox or store servers failing Underlying error mentions AMSErrorDomain, ASDErrorDomain or status 500; other apps' testers report the same at the same time
    No window or scene for the purchase sheet Console shows Could not find a UI anchor or confirmation scene near the failure
    Account or product setup incomplete Fails every time; the Paid Apps Agreement, banking or tax isn't Active, or the product is Missing Metadata
    Corrupted test state Fails only for one sandbox account or one simulator
    Purchases restricted on the device AppStore.canMakePayments is false (Screen Time or a device management profile)
    Test-environment bugs in Simulators and unit tests Fails only in the Simulator or XCTest

    Confirm it

    1. Log the whole error, not just its description:
    } catch {
        let ns = error as NSError
        print("Purchase failed: \(ns.domain) \(ns.code) \(ns.localizedDescription)")
        if let underlying = ns.userInfo[NSUnderlyingErrorKey] as? NSError {
            print("Underlying: \(underlying.domain) \(underlying.code) \(underlying.userInfo)")
        }
    }
    
    1. Check Apple's side: open Apple's Developer System Status and look at App Store Sandbox and In-App Purchases. A green status doesn't rule out a short incident, so also note whether the failure is intermittent.
    2. Isolate your code: run the same flow with a StoreKit configuration file selected in the scheme. If it works there, your purchase code is fine.
    3. Check restrictions: print AppStore.canMakePayments. If it's false, purchases are blocked on the device.
    4. Try a fresh sandbox account created in App Store Connect under Users and Access → Sandbox.

    Fix

    1. Server-side (500, AMS or ASD errors): your code isn't at fault. Show a "Couldn't reach the App Store, try again" message with a retry button, and retest later. If it lasts for hours in the sandbox, file a Feedback report with the underlying error.
    2. UI anchor or scene messages: start the purchase from a visible screen and give StoreKit a scene (purchase(confirmIn:) on iOS 17+, or SwiftUI's purchase environment action). See the purchase sheet page for the iOS 18.2 modal bug.
    3. Setup: make the Paid Apps Agreement, banking and tax Active, and complete each product's price and localization. See iOS returns no products.
    4. Test state: delete the app (or erase the Simulator), sign in with a new sandbox account, and retry.
    5. Restrictions: tell the user purchases are turned off in Screen Time, rather than showing a generic error.
    6. Simulator or XCTest only: test on a device, or use a StoreKit configuration file for automated tests.

    Stop it coming back

    • Always log NSUnderlyingError for StoreKit failures in debug builds and in your crash or analytics reporting. Without it, every Code=0 report looks the same.
    • Give every purchase failure a retry path in the UI. Many Code=0 failures are transient.
    • Before an App Review submission, check Apple's status page and do one sandbox purchase on a TestFlight build.

    If you use BillDog

    The iOS SDK passes StoreKit's error through rather than hiding it. A purchase that fails with Code=0 throws PurchaseError.storeKitError with code 0 and Apple's message. Your delegate's onPurchaseFailed receives it as BillDogError.storeError(code: 0, …).

    The SDK never retries a purchase behind the customer's back. Product requests that fail with StoreKitError.unknown are retried up to three times with backoff. This was checked against the source of the published iOS SDK 1.1.1-beta.5. It hasn't yet been reproduced on a device for this page.

    Related

    Sources

    Did this fix it?

    Frequently asked questions

    Is SKErrorDomain Code=0 my bug or Apple's?

    It can be either. The code alone doesn't say. The underlying error does: an HTTP 500 from Apple's servers means Apple's side, and a message about a window, scene or UI anchor means your app's presentation. Read NSUnderlyingError before changing code.

    Should my app retry automatically?

    Not the purchase. Apple says retrying may resolve the error in some cases, but a purchase should only be retried when the user taps again. Retrying a product request in the background is fine.

    Does it happen in production too, or only in the sandbox?

    Both, but it's reported far more often in the sandbox, whose servers are less reliable. App Review also uses the sandbox, so a sandbox outage during review can look like your bug to the reviewer.

    Why does it work with a StoreKit configuration file and fail in TestFlight?

    A configuration file never contacts Apple's servers. If purchases work with it and fail against the sandbox, your purchase code is fine, and the cause is App Store Connect setup or the sandbox itself.

    We use cookies and process your data to provide our services. By continuing, you agree to our Terms and Privacy Policy.