MKStoreKit不存储购买的产品

时间:2012-03-20 12:29:09

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

我正在使用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存储其他信息,这不是问题。

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

1 个答案:

答案 0 :(得分:0)

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

请记住,即使删除和删除购买都会被记住 重新安装应用程序。

相关问题