这是我第一次设置应用内购买,我被卡住了。当我尝试提出产品请求时,我收到错误“无效的产品 ID:TVRBIBLIA001”。我在 Stack Overflow 中看到了几个问题,寻找可能的解决方案但没有成功,所以我发布了自己的问题。这是我的应用内购买的设置。
这是我的代码:
#pragma mark -
#pragma mark Remove Ads InApp Purchase
- (IBAction)requestRemoveAdsProductData
{
NSSet *productIdentifiers = [NSSet setWithObject:@"TVRBIBLIA001"];
productsRequest = [[SKProductsRequest alloc] initWithProductIdentifiers:productIdentifiers];
productsRequest.delegate = self;
[productsRequest start];
// we will release the request object in the delegate callback
}
#pragma mark -
#pragma mark SKProductsRequestDelegate methods
- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response
{
NSArray *products = response.products;
removeAdsProduct = [products count] == 1 ? [[products firstObject] retain] : nil;
if (removeAdsProduct)
{
NSLog(@"Product title: %@" , removeAdsProduct.localizedTitle);
NSLog(@"Product description: %@" , removeAdsProduct.localizedDescription);
NSLog(@"Product price: %@" , removeAdsProduct.price);
NSLog(@"Product id: %@" , removeAdsProduct.productIdentifier);
}
for (NSString *invalidProductId in response.invalidProductIdentifiers)
{
NSLog(@"Invalid product id: %@" , invalidProductId);
}
// finally release the reqest we alloc/init’ed in requestProUpgradeProductData
[productsRequest release];
[[NSNotificationCenter defaultCenter] postNotificationName:kInAppPurchaseManagerProductsFetchedNotification object:self userInfo:nil];
}