What does unknownError (code 0) mean in the purchases SDK?
The purchases SDK raises unknownError (code 0) when a failure matches none of its named errors.
Quick facts#
| Error | ErrorCode.unknownError (iOS), PurchasesErrorCode.UnknownError (Android), code 0 |
| Where | Purchases SDK (iOS, Android and the hybrid SDKs built on them) |
| What the vendor says | Unknown error. Check the underlying error for more details. |
Cause#
- A StoreKit or Play Billing error that the SDK has no mapping for. On iOS,
StoreKitErrorcases that are newer than the SDK fall through to this error, and so does any other unmapped error. - On Android, an exception that is not a network, security or signature failure becomes
UnknownError, and so does any Play Billing response code outside the known list (errors.kt). - The backend answered with code 0, which the SDK reads as "we do not know what happened".
Fix#
- Read the underlying error: on iOS
NSUnderlyingErrorKeyandreadable_error_codeinuserInfo, on Androiderror.underlyingErrorMessage. - Turn on debug logs (
Purchases.logLevel = .debug) and read the lines before the error. - Update the SDK. A StoreKit or Play error that is new to the operating system can be unmapped in an old release.
- Do not unlock content and do not retry automatically; let the customer try again.
Example#
Swift
// The purchases SDK throws `ErrorCode` values; match the one you handle and let the rest fall through.
func handle(_ error: Error) {
guard let code = error as? ErrorCode else {
print("Not a purchases SDK error: \(error)")
return
}
switch code {
case .unknownError:
print("Unknown failure: read the underlying error and the debug log")
default:
print("Other purchases error: \(code.description)")
}
}Compile-checked: npm run check:snippets type-checks this snippet with swiftc together with the ErrorCode.swift file of the RevenueDot purchases-ios fork (checked 2026-10-03).
How the RevenueDot SDK reports it#
RevenueDot answers server failures with a numeric code, so a server problem reaches the SDK as a backend error and not as unknownError. The full deep dive is on revenuedot.app/errors/unknown-error.
Related#
- What does storeProblemError (code 2) mean in the purchases SDK?
- What does StoreKitError.unknown mean?
- What does networkError (code 10) mean in the purchases SDK?
- What RevenueDot's API errors mean (server codes)
Source#
- RevenueDot purchases-ios: ErrorCode.swift (the iOS ErrorCode enum)
- RevenueDot purchases-android: PurchasesErrorCode.kt (the Android enum)
- RevenueDot purchases-android: google/errors.kt (Play Billing mapping)
Checked: 2026-10-03