我正在努力让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设备上进行测试
发布于 2012-03-27 13:22:41
我不知道什么不管用,但在花了整整一天的时间让这个项目开始工作之后,我决定从头开始一个新的项目,然后再试一次。我做的每件事都一样,一切都成功了!
发布于 2013-03-02 10:10:01
一旦你的应用程序启动,打电话:
[MKStoreManager sharedManager];就这样。只要您在下载产品之后调用-buyFeature:方法(如果需要,您可以观察kProductFetchedNotification ),一切都按预期工作。
发布于 2013-08-18 04:55:38
确保将IAP密钥添加到MKStoreKitConfigs.plist.中。没有这一点,它什么也做不了。
此外,它可能需要几个小时,直到注册IAP成为可用的测试。
https://stackoverflow.com/questions/9880313
复制相似问题