【发布时间】:2015-02-16 21:41:46
【问题描述】:
我正在尝试在我的 iPhone 应用程序中使用可消耗的 InApp 购买。我使用this tutorial 作为参考。我正确地遵循了教程。但是我的产品没有加载。这是我的代码。
+ (RageIAPHelper *)sharedInstance {
static dispatch_once_t once;
static RageIAPHelper * sharedInstance;
dispatch_once(&once, ^{
NSSet * productIdentifiers = [NSSet setWithObjects:
@"com.ilfmobile.hero.twohundredconnects",
@"com.ilfmobile.hero.onethousandconnects",
nil];
sharedInstance = [[self alloc] initWithProductIdentifiers:productIdentifiers];
});
return sharedInstance;
}
我得到产品列表代码。
- (void)reload {
products = nil;
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
[[RageIAPHelper sharedInstance] requestProductsWithCompletionHandler:^(BOOL success, NSArray *theProducts) {
[MBProgressHUD hideAllHUDsForView:self.view animated:YES];
if (success) {
products = theProducts;
[self.tblview reloadData];
}
}];
}
我在 Xcode Capabilities 中实现了 InApp 购买。我附上截图如下。
我在 iTunes Connect 上启用了 InApp Purchases,并将这两个产品都添加到了 InApp 列表中。
请指出我错在哪里。感谢您抽出宝贵时间提出建议。我正在使用 Xcode5.1 和我的应用程序开发目标 iOS7.1
【问题讨论】:
-
你的意思是 products = theProducts 是 nil 吗?在这种情况下 theProducts 是 nil 还是 products 是 nil?
-
非常感谢您的快速反馈。我已经解决了我的问题。当我们在模拟器上测试应用程序时会出现这种类型的问题。
标签: ios objective-c iphone xcode in-app-purchase