2012-03-26 56 views
2

我试图让MKStoreKit与我的Cocos2D游戏一起工作。它看起来非常简单,我已经多次执行了所有步骤(检查我是否正确完成),但仍然无法实现。我可以检索产品名称,价格和描述等,但我可以使用共享的MKStoreKitManager进行购买。MKStoreKit购买功能什么都不做

这是我购买一个产品代码:

if([MKStoreManager isFeaturePurchased: @"com.testing.iap.removeAds"]) {  
     NSLog(@"No ads"); 
    }else{ 
     NSLog(@"Ads"); 

     NSLog(@"Buying feature..."); 

     [[MKStoreManager sharedManager] buyFeature: @"com.testing.iap.removeAds" 
             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:^ 
     { 
      NSLog(@"Something went wrong"); 
      // User cancels the transaction, you can log this using any analytics software like Flurry. 
     }]; 

    } 

基本上,如果该产品尚未以前购买的,打完折购买过程。这个问题没有发生!我甚至没有得到onCancelled被调用,除了我可以忽略的错误信息(即iCloud支持和自定义服务器选项)之外,没有任何错误信息。

任何人都可以阐明这是什么阻止我?

注:我测试运行iOS 5.1

回答

0

我不知道什么是不工作的iPhone 4设备上,但消费人最完整的工作日试图得到这个工作,我决定后,从头开始一个新项目,然后重试。我做了一切都完全一样,这一切工作!

+0

我现在正面临这个问题.... – user216661 2013-01-26 19:09:14

+1

比浪费时间修复第三方解决方案更容易实现StoreKit.framework和相关协议SKPaymentTransactionObserver,SKProductsRequestDelegate,SKRequestDelegate。 .. – holex 2013-08-18 08:41:19

2

只要你的应用程序启动,请致电:

[MKStoreManager sharedManager]; 

就是这样。只要您在产品下载完成后调用-buyFeature:方法(如果需要,您可以观察kProductFetchedNotification)一切都按预期工作。

+1

谢谢你。 MKStoreKit文档留下了许多不足之处。这也修复了NSUbiquitousKeyValueStore错误,许多人似乎也越来越多。 – Brynjar 2013-03-13 15:39:19

0

确保您已将您的IAP密钥添加到MKStoreKitConfigs.plist。没有它,它什么都不做。

此外,它可能需要几个小时,直到一个注册IAP变得可用于测试。

+0

Ehem,什么是IAP密钥,我如何将它插入MKStoreKitConfigs.plist? 谢谢。 – 2013-10-31 17:00:36