后台任务 9(“SKReceiptRefreshRequest”)是在 30 秒前创建的?

Jac*_*ack 4 xcode in-app-purchase swift

我正在使用SwiftyStoreKit SDK 在我的应用程序中进行应用内购买

由于某种原因,恢复无法正常工作,我在 xCode 控制台中收到此消息

日志 :

[BackgroundTask] Background Task 1 ("SKReceiptRefreshRequest"), was created over 30 seconds
     ago. In applications running in the background, this creates a risk of termination. Remember to
     call UIApplication.endBackgroundTask(_:) for your task in a timely manner to avoid this.
Run Code Online (Sandbox Code Playgroud)

我的恢复购买代码:

SwiftyStoreKit.restorePurchases(atomically: true) { results in
    if results.restoreFailedPurchases.count > 0 {
        print("Restore Failed: \(results.restoreFailedPurchases)")
    }
    else if results.restoredPurchases.count > 0 {


SwiftyStoreKit.fetchReceipt(forceRefresh: true) { result in
    switch result {
    case .success(let receiptData):
        let encryptedReceipt = receiptData.base64EncodedString(options: [])
        print("Fetch receipt success:\n\(encryptedReceipt)")
    case .error(let error):
        print("Fetch receipt failed: \(error)")
    }
}

        print("Restore Success: \(results.restoredPurchases)")
    }
    else {
        print("Nothing to Restore")
    }
}
Run Code Online (Sandbox Code Playgroud)

而且它一直在加载,没有任何进展,知道为什么吗?

Pet*_*mer 5

(在 Objective C 中)我无法解释为什么 SwiftyStoreKit 不起作用,但错误消息与方法中 SKReceiptRefreshRequest 的错误相同[request start];。当请求返回时,requestDidFinish:请求未正确释放并且需要一个[request cancel];