gpt4 book ai didi

iphone - MKStoreKit 购买功能不执行任何操作

转载 作者:行者123 更新时间:2023-12-03 21:03:51 25 4
gpt4 key购买 nike

我正在尝试让 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 设备上进行测试

最佳答案

您的应用启动后,立即调用:

[MKStoreManager sharedManager];

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

关于iphone - MKStoreKit 购买功能不执行任何操作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9880313/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com