我正在尝试让 MKStoreKit 与我的 Cocos2D 游戏一起使用。它看起来很简单,我已经按照所有步骤进行了几次(检查我是否正确完成了它),但我仍然无法让它工作。我可以检索产品名称、价格和描述等,但我可以使用共享的 MKStoreKitManager 进行购买。
这是我购买产品的代码:
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 的 iPhone 4 设备上进行测试