和标题说的差不多。该代码适用于我在沙盒环境中的所有开发设备以及我的大多数用户。但是,有一些用户报告说下载过程不会超出等待状态 (SKDownloadStateWaiting),即使在整个晚上离开也是如此。有些人在几次尝试后确实设法开始下载(完全关闭应用程序并通过恢复购买功能),所以它看起来确实是完全随机的。
这是我用来管理下载的代码:
- (void)paymentQueue:(SKPaymentQueue *)queue updatedDownloads:(NSArray *)downloads
{
SKDownload *download = [downloads objectAtIndex:0];
SKPaymentTransaction *transaction = download.transaction;
// Keep track of download status
switch (download.downloadState) {
case SKDownloadStateActive:
// Present time remaining and percentage
break;
case SKDownloadStateWaiting:
// Present "Waiting..." label
break;
case SKDownloadStateFinished:
[self purchaseNonconsumableAtURL:download.contentURL forProductIdentifier:productIdentifier];
[[SKPaymentQueue defaultQueue] finishTransaction:transaction];
break;
case SKDownloadStateFailed:
[[SKPaymentQueue defaultQueue] finishTransaction:transaction];
break;
case SKDownloadStateCancelled:
[[SKPaymentQueue defaultQueue] finishTransaction:transaction];
break;
default:
break;
}
}
任何帮助将非常感激。