Background Task SKReceiptRefreshRequest was created over 30 seconds ago

9
closed
victorkifer
victorkifer
Posted 1 year ago

Background Task SKReceiptRefreshRequest was created over 30 seconds ago #74

After refreshing receipt I'm getting a warning:

Background Task 3 ("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.

The request completes successfully and the warning appears later on. It seems to be similar to https://github.com/RevenueCat/purchases-ios/issues/391

And it should probably be resolved by cancelling the request both after success and error in RefreshSession, similar to what is done https://github.com/RevenueCat/purchases-ios/pull/418

tikhop
tikhop
Created 1 year ago

Hi @victorkifer,

Weird, it was fixed here https://github.com/tikhop/TPInAppReceipt/commit/96a960c8a1ee66ea55c9e1c7738a7e1849532cbc. Are you using cocoapods/SPM?

victorkifer
victorkifer
Created 1 year ago

@tikhop Yes, I'm using cocoapods. It seems version 3.0.2 is not published yet. Do you plan to publish it anytime soon?

tikhop
tikhop
Created 1 year ago

Yeah, I will do it tonight.

tikhop
tikhop
Created 1 year ago

@victorkifer Just published.

DamienPetrilli
DamienPetrilli
Created 1 year ago

Hi!

Running 3.0.2 and still getting the error message!

[BackgroundTask] Background Task 2 ("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.

<SKReceiptRefreshRequest: 0x282276ac0>: Finished refreshing receipt with error: Error Domain=NSURLErrorDomain Code=-1001 "The request timed out." UserInfo={NSLocalizedDescription=The request timed out., NSUnderlyingError=0x282e68990 {Error Domain=kCFErrorDomainCFNetwork Code=-1001 "The operation couldn’t be completed. (kCFErrorDomainCFNetwork error -1001.)" UserInfo={NSLocalizedDescription=The operation couldn’t be completed. (kCFErrorDomainCFNetwork error -1001.)}}}

Something went wrong: The request timed out.

Error Domain=NSURLErrorDomain Code=-1001 "The request timed out." UserInfo={NSLocalizedDescription=The request timed out., NSUnderlyingError=0x282e68990 {Error Domain=kCFErrorDomainCFNetwork Code=-1001 "The operation couldn’t be completed. (kCFErrorDomainCFNetwork error -1001.)" UserInfo={NSLocalizedDescription=The operation couldn’t be completed. (kCFErrorDomainCFNetwork error -1001.)}}}

May be related to the network issue?

tikhop
tikhop
Created 1 year ago

Hi @DamienPetrilli,

Might be the network issue, since the request times out and i think default request timeout is 60 sec, so you get that message about "SKReceiptRefreshRequest" first and then the error about request timeout. So, at the end we still call UIApplication.endBackgroundTask(_:).

I will check how it works for me.

DamienPetrilli
DamienPetrilli
Created 1 year ago

It might be just when you use Xcode for IAP. I just wanted to make sure nothing was missed.

xabodog
xabodog
Created 6 months ago

[BackgroundTask] Background Task 3 ("GDTStorage"), 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.

This problem occurred recently, and the console keeps printing.

xabodog
xabodog
Created 6 months ago

version 8.6