Pretty much what the title says. The code works fine for all my development devices in the sandbox environment and for a majority of my users. However, there are some users reporting that the download process doesn't move beyond the waiting state (SKDownloadStateWaiting), even when left through the night. Some do manage to get the download started after a few tries (closing the app completely and going through restore purchases feature), so it does look to be completely random.
Here is the code I'm using to manage downloading:
- (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;
}
}
Any help would be much appreciated.
You can try to start a download that's in SKDownloadStateWaiting by calling
My application would always get downloads that were in a permanent "waiting" state when it attempted to resume earlier transactions. I edited the paymentQueue updatedDownloads function so that whenever it's called with a download that's in a waiting state, it will pass that download to startDownloads, and this seemed to fix the issue.