Why is getOfferings not calling completion on iOS 15?

  • 19 October 2021
  • 2 replies
  • 97 views

Userlevel 2
Badge +4
  • RevenueCat Staff
  • 34 replies

 

We’ve had a few reports about the offerings:completion: method on iOS not calling its corresponding completion block, specifically on iOS 15.

In Flutter, React-Native, Cordova/Ionic and Unity, this method is called getOfferings

If you’re using async / await syntax, this will manifest as the await call not completing. 

 

This seems to be a bug in iOS 15, where the underlying SKProductsRequest made by the SDK doesn’t call its completion handlers (in the form of delegates). 

 

Once the bug manifests, it might prevent you from making purchases of other, regular items in Production, like downloading a new app from the App Store, even if you uninstall your app, until you reboot the device.

The biggest telltale sign of this bug happening is finding the following line in the debug logs on iOS 15, but having everything work correctly on iOS 14:

[BackgroundTask] Background Task 12 ("SKProductsRequest"), 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 bug seems to apply specifically to the Sandbox environment, meaning that things should work as normal in Production. 

It also seems to apply only to some Sandbox accounts. 

If this is happening to you, the easiest workaround is to clear your current credentials and use a new Sandbox account. The only reliable way to do this involves signing out and doing a reboot:

  • Create a new Sandbox account in App Store Connect. This is important, since folks have reported that existing accounts might not recover from the bug. 
  • Sign out of your current sandbox account in Settings → App Store → Sandbox Account
  • Sign out of your App Store account in Settings → <Your name> → Media & Purchases. 
  • Reboot the device
  • Sign in to the new Sandbox account in Settings → App Store → Sandbox Account
  • At this point, you should also be able to sign in to your App Store account in Settings → <Your name>. 

We worked on a patch to address this behavior. While we cannot fix the iOS bug ourselves, we’ve introduced a timeout to the SKProductsRequest, which should ensure that getOfferings returns a value (an error, in the case of this bug).

However, we haven’t been able to reproduce this bug, so if this bug reproduces consistently for you, and you’d like to try out the fix (available here):

 

For purchases-ios version 4: 

Set the Dependency Rule to Up to next major, and the version number to 4.0.0 < 5.0.0.

 

For purchases-ios version 3: 

If you’re using Swift Package Manager: 

Set the Dependency Rule to Up to next major, and the version number to 3.12.8 < 5.0.0.

If you’re using CocoaPods: 

Update your Podfile to: 

pod 'Purchases', '~> 3.12.8'

If you’re using Carthage: 

Update your Cartfile to: 

github "revenuecat/purchases-ios" ~> 3.12.8

 

We’re working on propagating the fix to our Hybrid SDKs as well (Flutter, React-Native, Ionic/Cordova and Unity). 

If this is happening to you in one of our Hybrid SDKs and would like to early-test the fix, let me know! 

 

If you’d like to find out more about the issue, here are a few tickets where we’ve discussed it: 

Edit: purchases-ios version 3.12.8 has been released, updated the way to get the latest version. 


2 replies

Userlevel 2
Badge +4

We’ve had some reports that iOS 15.1 solves this issue. If you’re running into it, consider updating your test device to iOS 15.1 (currently in beta).

Userlevel 2
Badge +4

Update: iOS 15.1 has been released, so if you’re experiencing this issue, give it a shot with the new iOS version, we’ve heard it solves the bug. We haven’t been able to verify, though, as we don’t have an account that triggers the bug in the first place. 

 

We’ll also be publishing a new version of purchases-flutter this week that includes the fix. 

Reply