加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ios – SKMutablePayment属性:applicationUsername

发布时间:2020-12-14 19:32:21 所属栏目:百科 来源:网络整理
导读:我正在我的应用程序中实施In App Purchases,我正在使用非消耗性产品. 我在我的应用程序中有用户登录,并防止使用applicationUsername属性的不正常活动苹果sugest,所以我可以发送用户的用户名付款. 一切正常,我可以设置payment.applicationUsername属性,我可以
我正在我的应用程序中实施In App Purchases,我正在使用非消耗性产品.
我在我的应用程序中有用户登录,并防止使用applicationUsername属性的不正常活动苹果sugest,所以我可以发送用户的用户名付款.

一切正常,我可以设置payment.applicationUsername属性,我可以在SKPaymentTransactionStatePurchased状态购买完成后将其恢复.

问题是,当我尝试使用restoreCompletedTransactionsWithApplicationUsername:方法恢复我的事务时,applicationUsername属性返回NULL.

你能帮我吗?

解决方法

经过大量研究后我发现我们不能将applicationUsername用于此目的.

对于restoreCompletedTransaction,您可以使用transaction.originalTransaction.transactionIdentifier属性
(它在新购买时是等价的 – transaction.transactionIdentifier).

这是与恢复记录中找到的购买本身和iTunes帐户关联的唯一标识符.

1.如何使用它:

Record that Original transactionIdentifier on your server as
associated with the original purchase by user A.

2.检测不规则活动

If another user tries to restore their purchase check to be sure the
transactionIdentifier has not already been used under a different
userName.

如果您的所有用户都没有使用此transactionIdentifier,那么还原成功.如果已经从另一个用户使用了transactionIdentifier,那么解释用户无法进行还原的原因.

This is essentially equivalent to using ‘transaction.transactionIdentifier’ as the ‘applicationUsername’.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读