How should I react to SKErrors with error code 0 on subscription starts?

Sometimes, in my iOS app subscription starts fail in production with an SKError with code 0. This code means that an "unknown or unexpected error" occurred, and in this case I display the localized description to the user. In most cases this is "Cannot connect to iTunes Store".

What are the most common reasons for this? Can I provide better suggestions to the user than "Try again"? Is this usually a problem with their Apple ID, or a network failure?

Futher, I noticed that in some cases there is an underlying error object with the error domain ASDServerErrorDomain. Is this error domain documented somewhere? I couldn't find any information about this. I have seen multiple cases where this underlying error had the code 3532, and the NSLocalizedDescription is:

You’re currently subscribed to this.

I find that surprising because (1) I would expect that StoreKit simply treats this as a successful "purchased" transaction (I think this case is mentioned on some WWDC talk) instead of throwing an error and (2) there is no documented way to detect this case and unlock the subscribed content for the user.

What's the recommended way to react to this error? What should I display to the user? The localized description of the SKError itself is in this case

An unknown error occurred

which is not helpful at all.

Replies

Hi everyone!
I've got the same error (SKError.Code.unknown, i.e. 0) and underlying message.
It appears when a client tries to purchase the same product second time.
It looks like this case shouldn't happen, because if all set correct, client shouldn't generate purchase second time.
But I guess, it is easy to reproduce it having second device for the same appleId and initiating second purchase.

Ways to reproduce:
  1. Client chooses product item

  2. AppStore shows message that such product has been purchased and is still active

  3. SKPaymentTransactionObserver gets error: SKError.Code.unknown with underlying message (as noticed in initial message of this thread)

So, client knows what happened and transaction observer too.
It is helpful for transaction observer as we can disable spinner on product items screen (for example), but what about other cases when we get such .unknown error code and other underlying messages?

Should we show "Unknown message happened" to a client or just react on it silently, without client notification, and restoring purchases in a background?
Can developers rely on such underlying messages?
What's the goal of such error code?

Thanks in advance.