What to do with SKDownloadStateFailed, except for the warning?

I do not find examples or StoreKit open source projects that correctly apply to SKDownloadStateFailed . At best, they show a UIAlertView . Can't I do anything to retry downloading programmatically? And how should users re-upload content hosted on Apple?

The only way I found is to initiate the purchase again. But first it asks the user if he wants to spend money. After that, he informs the user that he has already bought it and can download it for free.

+4
source share
1 answer

You can resume the download by first pausing all downloads and then resuming all downloads. Below are the helper methods that I use. Please note that I am using an instance variable containing strong references to every SKTransaction loaded.

 - (void)pauseAllDownloads { METHOD; for (SKPaymentTransaction *transaction in self.transactionsBeingDownloaded) { [[SKPaymentQueue defaultQueue] pauseDownloads:transaction.downloads]; } [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO]; //stop the dl activity icon in the status bar } - (void)resumeAllDownloads { METHOD; if (self.transactionsBeingDownloaded.count == 0) { [self restoreCompletedTransactions]; } else { for (SKPaymentTransaction *transaction in self.transactionsBeingDownloaded) { NSLog(@"state: %i", transaction.transactionState); [[SKPaymentQueue defaultQueue] resumeDownloads:transaction.downloads]; } } [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES]; //show the dl activity icon in the status bar } 
0
source

All Articles