Correct Filepaths for Restoring Apple-Hosted Content

Greetings folks, I'm implementing logic for restoring my app's non-consumable purchases, but I seem to be hitting a roadblock.

It seems my app is looking for the original .zip file that was downloaded from Apple's hosted content servers in the first transaction. But of course, I'm deleting this file after the initial download is completed and the files are transferred out of the Caches directory. So now when this function is called upon trying to restore purchases, the content is not restored.

Here's my processDownload function that gets called when active downloads polled in paymentQueue(_ queue: SKPaymentQueue, updatedDownloads downloads: [SKDownload]) are updated to SKDownloadState.finished

Code Block language
public func paymentQueue(_ queue: SKPaymentQueue, updatedDownloads downloads: [SKDownload]) {
for download in downloads {
switch download.state {
case SKDownloadState.active:
let p = "downloadProgress_" + download.contentIdentifier
NotificationCenter.default.post(name: NSNotification.Name(rawValue: p), object: download.progress)
                break
            case SKDownloadState.finished:
                processDownload(download)
                break
            default:
                break
                }
            }
    }
func processDownload(_ dl: SKDownload) {
let pathDestination: String = NSSearchPathForDirectoriesInDomains(.libraryDirectory, .userDomainMask, true)[0]
guard let hostedContentPath = dl.contentURL?.appendingPathComponent("Contents") else {
return
        }
do {
let files = try FileManager.default.contentsOfDirectory(atPath: hostedContentPath.relativePath)
for file in files {
let source = hostedContentPath.appendingPathComponent(file)
let d = URL(fileURLWithPath: pathDestination.appending("/" + file))
do {
try FileManager.default.moveItem(at: source, to: d)
print("moving ", file, " to safety")
} catch {
print("failed to move file")
        }
}
/* delete downloaded file in cache */
    do {
try FileManager.default.removeItem(at: dl.contentURL!)
    } catch {
    }
    deliverPurchaseNotificationFor(identifier: dl.contentIdentifier)
     SKPaymentQueue.default().finishTransaction(dl.transaction)
} catch {
    print("filepath error")
    }
}


When tapping the restore button, I can see console activity which shows that the restored transactions are being queued up, but instead of downloading them again, the state of the download remains SKDownloadState.finished and my processDownload function looks for the now deleted cache file any following situations where this function runs again (such as when restoring purchases).

Is my method shown above the wrong approach for this situation?
Correct Filepaths for Restoring Apple-Hosted Content
 
 
Q