You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

应用内购中途取消返回SKErrorDomain Code=2,咨询苹果官方相关文档

关于SKErrorDomain Code=2的官方说明解析

Hey fellow developer, let me break this down clearly for you—this is a super common StoreKit error I’ve dealt with countless times!

First off, SKErrorDomain Code=2 directly maps to SKErrorPaymentCancelled in the StoreKit framework. This error is triggered exactly when the user actively cancels the in-app purchase flow—think tapping the "Cancel" button on the Apple ID authentication sheet, or backing out of the payment confirmation dialog.

And yes, Apple absolutely has official documentation covering this! In Apple’s StoreKit reference docs, the SKError enumeration explicitly lists this error code as representing a user-initiated cancellation. It’s categorized as an expected, non-failure scenario—this isn’t a bug in your app or a system error, just the user choosing to abort the purchase.

A quick tip for handling this: You usually don’t need to show an error alert to the user here, since they chose to cancel. Instead, you can just log the event for your own analytics and return the user to the normal app flow seamlessly.

内容的提问来源于stack exchange,提问作者wes. i

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.27 09:44:59