SKError.Code.unknown

We have a question related to in app purchases and subscriptions. We would like to know if it is possible to explain the following error:

https://developer.apple.com/documentation/storekit/skerror/code/unknown

This error happened 223 times in May alone, and the only message we are getting is "An unknown error occurred", but what are the causes for this issue and how can we fix it?

Is there a list of all possible reasons?

Thanks,

Tawazon Team

Replies

Hi @rami256 & Tawazon Team,

I think SKError.Code.unknown is more a catch-all code for a huge variety of possible uncategorised reasons as to why StoreKit returned an error - I doubt Apple are willing to specify a list of all possible reasons as to why there might have been a failure when this code is issued, for one because it might be a little embarrassing for them, ha.

In my experience so far, not that my app is yet live, it is mainly to do with a user's App Store account - i.e. invalid state, account access issue, payment problem, etc.

When this error is thrown, try printing out the details of the NSError to see if you can glean more detail as to what it might be - e.g. NSError.localizedDescription/underlyingErrors/userInfo/localizedFailureReason/localizedRecoveryOptions/localizedRecoverySuggestion, etc.

I used to get this error code a lot when first developing the auto-renewable subscription functionality in my app, but I don't get it anymore since properly hooking up my Sandbox user testing account.

Hope that helps you guys out anyway.

Cheers, Ben