【问题标题】:MKStoreKit not storing purchased ProductsMKStoreKit 不存储购买的产品
【发布时间】:2012-03-20 12:29:09
【问题描述】:

我正在使用 MKStoreKit 在我的应用程序中实现 IAP。购买产品时一切都按预期进行,根本没有错误消息。该产品是使用以下代码购买的..

 [[MKStoreManager sharedManager] buyFeature:@"pro_upgrade" 
                                onComplete:^(NSString* purchasedFeature)
 {
     NSLog(@"Purchased: %@", purchasedFeature);
     // provide your product to the user here.
     // if it's a subscription, allow user to use now.
     // remembering this purchase is taken care of by MKStoreKit.
 }
                               onCancelled:^
 {
     // User cancels the transaction, you can log this using any analytics software like Flurry.
 }];

购买产品后,我会收到确认购买的通知(通过下面的代码)..

[[NSNotificationCenter defaultCenter] addObserver:self 
                                         selector:@selector (subscriptionPurchased:) 
                                             name: kSubscriptionsPurchasedNotification 
                                           object:nil];

购买后,我执行以下代码(如文档所示)以确定产品是否已购买..

if([MKStoreManager isFeaturePurchased:@"pro_upgrade"]) {
    NSLog(@"This feature is purchased.");
} else {
    NSLog(@"This feature is not purchased");
}

对于产品 ID,它不断返回 NO。当在与购买产品时相同的实例中运行应用程序以及关闭和打开应用程序时,会发生这种情况。使用开发或分发证书运行应用程序完全没有区别。此外,我无法找到 MKStoreKit 究竟在哪里存储了它似乎正在寻找的购买的 BOOL 产品(它在代码中非常深入,所以我不是说它有或没有,我只是找不到它) .我的应用正在使用 NSUserDefaults 存储其他信息,所以这不是问题。

非常感谢您提供的任何帮助,感谢您的宝贵时间。

【问题讨论】:

  • 另外值得注意的是,它是基于订阅的 IAP。我还在控制台中收到以下错误消息。现在无法检查审核请求:(null)
  • review request cannot be checked now 没问题。

标签: iphone ios xcode in-app-purchase mkstorekit


【解决方案1】:

MKStoreKit 不存储在 NSUserDefaults 中。 我改用钥匙串。在方法中放置断点 storeData:forKey: (直接从我的脑海中写下这个方法名称 不看代码,搜索类似命名的方法)并尝试 调试它。这是我保存你购买的地方。

请记住,即使在删除和 重新安装应用程序。

【讨论】:

猜你喜欢
  • 2015-10-30
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-03-13
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多