我有一个刚刚提交更新的 iOS 应用程序。该应用程序的开发版本(模拟器和我的 4S)从未崩溃,并且运行良好。该应用程序今天和 IAP 一样获得批准,但今天早上我意识到 iAP 并未“批准购买”。我刚刚清除它以进行购买,但应用程序仍然崩溃。iPhone给出的错误(运行应用商店版本)给出了错误:
<Error>: *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayI objectAtIndex:]: index 0 beyond bounds for empty array'
这是发生这种情况的代码:
- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:
(SKProductsResponse *)response
{
NSArray *myProduct = response.products;
//this line is where the error occurs
noAdProduct = [myProduct objectAtIndex:0];
if (![[[NSUserDefaults standardUserDefaults] objectForKey:@"the id here"] boolValue]) {
adCell.detailTextLabel.text = [NSString stringWithFormat:@"$%@", noAdProduct.price];
adCell.userInteractionEnabled = YES;
adCell.accessoryType = UITableViewCellAccessoryNone;
adCell.accessoryView = nil;
[self.tableView reloadData];
}
}
在请求可用产品列表时会发生这种情况,这显然会在模拟器中返回产品,而不是在应用程序中。我刚刚添加了一个防范措施,但我需要再次将其提交到 App Store。
有谁知道为什么 iAP 没有出现在 App Store 版本中?我是否需要等待“已批准出售”选项才能访问 Apple 的服务器?谢谢!