SDK error · code 10

networkError (error code 10): Network error

What it means

networkError (code 10) means a request could not finish on the network: a timeout, a dropped connection, an unreachable host, a TLS failure or an unreadable response. It is temporary. The SDK keeps unposted purchases and sends them again later. Check the device's connection and your proxy URL, retry the screen with a short backoff, and never grant access from the error.

Code

10

iOS (Swift)

ErrorCode.networkError

Android (Kotlin)

PurchasesErrorCode.NetworkError

Causes

Why the SDK returns networkError

  • iOS: any URLSession failure other than "not connected to the Internet" (which becomes offlineConnectionError) maps here, and so does a request the SDK could not build (NetworkError.swift).
  • Android: an IOException or JSONException while performing the request (errors.kt).
  • Android: Play Billing NETWORK_ERROR, which Google describes as a network connection problem between the device and Play and says to retry with backoff (Google docs).
  • A wrong proxy URL: a typo, http instead of https, a missing port, or localhost on an Android emulator, where localhost is the emulator itself.
  • Android blocks cleartext HTTP by default, so an http:// server fails unless you allow it for that host.

Fix

How to fix networkError

  1. 01

    Check the connection and retry

    Retry the action after a short wait, and back off if it fails again. Google recommends simple retries or exponential backoff for NETWORK_ERROR.

  2. 02

    Check the proxy URL

    Set the proxy URL before configure. On an Android emulator use http://10.0.2.2:8787 for a server on your computer, or use HTTPS. See common problems.

  3. 03

    Run the SDK health check

    On iOS, call PurchasesDiagnostics.default.testSDKHealth(). It reports whether the SDK can reach the server and whether the API key is valid.

  4. 04

    Read the underlying error

    On iOS, NSUnderlyingErrorKey holds the URLError with the real reason, such as a timeout or a TLS failure. On Android read underlyingErrorMessage.

In your app

How to handle it in code

  • Retrying is safe. The SDK keeps unfinished purchases and posts them again on its own, so the customer does not lose a purchase to a bad connection.
  • Show "Check your connection and try again". Keep the screen usable with cached data.
  • Do not grant access from the error. The SDK serves cached customer info when it has it.
  • Log the underlying error. Many networkErrors from one version of one carrier or country point to a routing or TLS problem.
Match the errorSwift · Kotlin
// Swift
do {
  let result = try await Purchases.shared.purchase(package: package)
} catch let error as ErrorCode where error == .networkError {
  // handle network error
}

// Kotlin
if (error.code == PurchasesErrorCode.NetworkError) { /* ... */ }

On RevenueDot: If RevenueDot is unreachable, the SDK sees a connection error. If it answers 5xx, which it does for its own failures and store outages, the SDK keeps the purchase unfinished and computes access on the device from the product-to-entitlement mapping the server provides. See offline entitlements and 4xx or 5xx on a receipt.

FAQ

networkError: questions people ask

What causes networkError in the RevenueCat SDK?

A request failed on the network: a timeout, a dropped connection, an unreachable host, a TLS failure or an unreadable response. With a self-hosted server, a wrong proxy URL is the most common cause.

Will a customer lose a purchase because of networkError?

No. The SDK keeps the store transaction unfinished when it cannot post it, and posts it again later. The customer's access appears once the post succeeds.

Why does my Android emulator get networkError with a local server?

On an emulator, localhost is the emulator itself. Use http://10.0.2.2:<port> for a server on your computer, and allow cleartext HTTP for that host or use HTTPS.

How do I check for networkError in React Native and Flutter?

In React Native, compare error.code with PURCHASES_ERROR_CODE.NETWORK_ERROR. In Flutter, convert the PlatformException with PurchasesErrorHelper.getErrorCode(e) and compare the result with PurchasesErrorCode.networkError.

Get started

Keep the RevenueCat SDK. Change the backend.

RevenueDot answers the same SDK calls with the same error codes. Start free on RevenueDot Cloud, free up to $10,000 a month in tracked revenue.

Already have an account? Sign in · Prefer your own servers? Self-host free