正如标题所示, 当请求一个SKProducts的列表并从模拟器运行时,我会得到正确的数组,但是在实际的iPhone上,数组将包含0个项目。iOS应用内SKProduct没有显示在iPhone上,但在模拟器中做
NSSet *productSet = [NSSet setWithObject:@"com.somewebsite.someapp.inappproduct"];
SKProductsRequest *pr = [[SKProductsRequest alloc]initWithProductIdentifiers:productSet];
pr.delegate = self;
[pr start];
[[SKPaymentQueue defaultQueue] addTransactionObserver:self];
#pragma mark - purchasing
- (void)productsRequest:(SKProductsRequest *)request
didReceiveResponse:(SKProductsResponse *)response
{
NSLog(@"response = %@",response.products);
if (response.products.count > 0)
{
self.products = response.products;
[thetable insertSections:[NSIndexSet indexSetWithIndex:1] withRowAnimation:UITableViewRowAnimationFade];
}
}
它在模拟器中不起作用。 – samfisher 2012-01-28 06:09:26
它适用于我的模拟器 – ssj 2012-01-28 06:13:14
您需要确保设备使用正确的软件包标识符,并注册到itunesconnect应用程序中。这可能是最强有力的原因。 – samfisher 2012-01-28 06:16:08