您可以先重新启动下载,方法是先暂停所有下载,然后重新开始所有下载。以下是我使用的帮手方法。请注意,我使用包含对正在下载的每个SKTransaction的强引用的实例变量。
- (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
}
凹凸。我正在尝试使用模拟器,这可能是罪魁祸首,但是在SKDownloadStateFailed:ing之后,似乎没有办法重新开始下载,甚至没有另一次购买。 – Jonny 2013-07-24 09:17:44