当我在模拟器中运行以下代码时,它可以成功获取 IAP 信息,但是当它在真正的 IPAD 上运行时,“计数”总是 = 零......有什么想法有什么问题吗?谢谢。
// Store Kit returns a response from an SKProductsRequest.
- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response {
// Populate the removeAdsButton button with the received product info.
SKProduct *validProduct = nil;
int count = [response.products count];
if (count>0) {
validProduct = [response.products objectAtIndex:0];
}
if (!validProduct) {
[removeAdsButton setTitle:@"No Products Available" forState:UIControlStateNormal];
removeAdsButton.enabled = NO;
return;
}
NSString *buttonText = [[NSString alloc] initWithFormat:@"%@ - Buy $%@", validProduct.localizedTitle, validProduct.price];
[removeAdsButton setTitle:buttonText forState:UIControlStateNormal];
removeAdsButton.enabled = YES;
[buttonText release];
}