SKDownload - finishTransaction on download fail

I have a non-consumable IAP that has content hosted with Apple. While testing, I have seen a failed download. Should I close the transaction on download .failed?



for download in downloads {

    switch download.downloadState {

    case .active:
        // deal with active
     
        break
    case .failed:
    // inform the user the download failed

    // should I close the transaction here? ie:
    SKPaymentQueue.default().finishTransaction(download.transaction)

    break
  // cut code...
    }

} // end each download



If I did close the transaction, then the user would need to click on restore to start the download again. If I did not close the transaction, then I am presuming Apple will send the purchase or restore again later, which would trigger a download and have a chance to complete on .finished.

Accepted Reply

A StoreKit app should only call finishTransaction when the transaction is considered completed by the app; the app has no more processing to perform. If the hosted content download fails to download completely, the purchase is not complete. By not calling finishTransaction, the transaction remains incomplete on the iTunes Store server. Later when the user relaunches the app and the addTransactionObserver method is called at launch time, the transaction observer will detect the incompleteTransaction and notify the app via the updatedTransactions delegate method. The app can again retry to download the hosted content.


When completed, then the app calls finishTransaction.


rich kubota - rkubota@apple.com

developer technical support CoreOS/Hardware/MFI

Replies

A StoreKit app should only call finishTransaction when the transaction is considered completed by the app; the app has no more processing to perform. If the hosted content download fails to download completely, the purchase is not complete. By not calling finishTransaction, the transaction remains incomplete on the iTunes Store server. Later when the user relaunches the app and the addTransactionObserver method is called at launch time, the transaction observer will detect the incompleteTransaction and notify the app via the updatedTransactions delegate method. The app can again retry to download the hosted content.


When completed, then the app calls finishTransaction.


rich kubota - rkubota@apple.com

developer technical support CoreOS/Hardware/MFI