IAP无法在Real iPad上运行

时间:2013-02-05 13:54:44

标签: xcode cocoa-touch ios5 in-app-purchase

当我在模拟器中运行以下代码时,它可以成功获取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];
}

1 个答案:

答案 0 :(得分:1)

我发现如果设备是JB,它将无法工作..