MKStoreKit -isSubscriptionActive总是返回False [英] MKStoreKit -isSubscriptionActive always return False

查看:278
本文介绍了MKStoreKit -isSubscriptionActive总是返回False的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用MKStoreKit进行自动续订。

I am Using MKStoreKit for autorenewable subscription.

On Button的TouchUpInside方法我正在使用以下代码..

On Button's TouchUpInside method I am using following code..

if([[MKStoreManager sharedManager] isSubscriptionActive:kSubscriptionMonthlyIdentifier]){
  //access to subscription feature
}else{
  //ask user to buy
}

它总是让我失误。并要求用户购买。

It always returns me false. And ask user to buy.

当我再次尝试购买时,它向我显示您已经订阅了

When I tried to buy again it shows me that You are already subscribed.


  • 我有什么问题吗?

  • Is there something that I am doing wrong?

是否有其他方法可以检查订阅是否有效。

Is there any other method to check if subscription is active or not.

我应该如何知道订阅是否已续订?

How should I know that subscription is renewed?

任何帮助将不胜感激。

Any help would be appreciated.

先谢谢。

推荐答案

1)你应该通过添加 [MKStoreManager sharedManager]来初始化MKStoreKit; 在你的applicationDidFinishLaunching中。

1) You should initialize MKStoreKit by adding [MKStoreManager sharedManager]; in your applicationDidFinishLaunching.

2)你应该检查一下,你是否正确填写 MKStoreKitConfigs.plist

2) You should check, that you correctly fill MKStoreKitConfigs.plist:

您必须将订阅的应用内商家ID添加到订阅字典(格式为:subs id - 子持续时间)。

you must add your subscriptions in-app ids to Subscriptions dictionary (in format: "subs id" - "subs duration").

在Apple文档中,您可以找到有关自动更新潜艇的信息:
每次更新将生成自动更新订阅新事务并将其发送到您的应用程序。理论上,MKStoreKit必须关注所有这些东西,并且 isSubscriptionActive 应该可以工作。

In apple documentation you could find info about auto-renewable subs: every renewal of the auto-renewable subscription new transaction would be generated and send to your application. In theory, MKStoreKit must take care about all this stuff, and isSubscriptionActive should work.

此外,你可以添加用于恢复以前购买的按钮。所以,在你的情况下,当用户在调用 -isSubscriptionActive 之前按下购买按钮调用 -restorePreviousTransactions ,或者你可以添加这个按钮,因此用户可以恢复以前的交易^如果他已经购买了订阅。

Also, you could add button for restoring previous purchases. So, in your case, when user press buy button before calling -isSubscriptionActive call -restorePreviousTransactions, or you can add this button, so user can restore previous transaction^ if he already has bought subscription.

您可以为此通知添加观察者:

You could add observers for this notifications:

#define kSubscriptionsPurchasedNotification @"MKStoreKitSubscriptionsPurchased"
#define kSubscriptionsInvalidNotification @"MKStoreKitSubscriptionsInvalid"

第一次通知MKStoreKit在续订(或购买)订阅时生成第二个 - 续订失败时。

First notification MKStoreKit generate, when Subscription was renewed (or purchased), second one - when renewing failed.

这篇关于MKStoreKit -isSubscriptionActive总是返回False的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆