当我在模拟器中运行以下代码时,它可以成功获取IAP信息,但是当它在真正的IPAD上运行时,“count”总是=零......任何想法有什么不对?感谢。
// 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];
}
答案 0 :(得分:1)
我发现如果设备是JB,它将无法工作..