Solved

iOS 15/Xcode 13 [[RCPurchases sharedPurchases] offeringsWithCompletionBlock:] is never called

  • 24 September 2021
  • 33 replies
  • 2149 views


Show first post

33 replies

We’ve been trying to reproduce this, and I’ve been digging around seeing if other folks have the same issue. This is super weird, but I think it might be `StoreKit` side- as in, this appears to be an Apple problem 😿
 

 

@ryan’s response looks like it applies to your current situation, specifically 

The “Requesting products from the store with identifiers: … “ log message indicates that the product IDs were fetched successfully from RevenueCat and now a request is being made from the device to Apple to return the products with those IDs.

 

The fact that restarting the device or resetting it then allows it to work makes sense. IIRC StoreKit uses XPC to communicate with other device services to make the requests. If something happens between other services like something dies, or just spins, the XPC can timeout or just hang without any more information passed back about the situation. This is totally just speculation.

Since we can’t reproduce on our side, one thing you could try is to take those product ids that you have and manually request the products from Apple via StoreKit and see if the same thing happens. I’m still going through our code to double-check for potential issues.

Badge +2

My issue was caused by this.  The IOS upgrade turned out to be a red herring.

This workaround is really helpful to document, thank you!

 

Also, @Andy found some places where completion blocks might not be called and he put a PR up: https://github.com/RevenueCat/purchases-ios/pull/879. I don’t think this helps your specific case (because iOS 14 works fine), but when it comes to different iOS versions I wouldn’t be entirely surprised if it did help somehow.

 

 

Userlevel 1
Badge +3

@Andy looks like it still occurs with release/3.12.8 and the existing failing account:


2021-10-20 13:43:54.096509+0800 SKProductsDemo[316:4690] [Purchases] - ERROR: 🍎‼️ SKProductsRequest took longer than 30 seconds, cancelling request and returning an empty set. This seems to be an App Store quirk. If this is happening to you consistently, you might want to try using a new Sandbox account. More information: https://rev.cat/skproductsrequest-hangs
2021-10-20 13:43:54.097286+0800 SKProductsDemo[316:4672] [Purchases] - ERROR: 🍎‼️ Error fetching offerings - Error Domain=RCPurchasesErrorDomain Code=23 "There's a problem with your configuration. None of the products registered in the RevenueCat dashboard could be fetched from App Store Connect (or the StoreKit Configuration file if one is being used). 
More information: https://rev.cat/why-are-offerings-empty" UserInfo={NSLocalizedDescription=There's a problem with your configuration. None of the products registered in the RevenueCat dashboard could be fetched from App Store Connect (or the StoreKit Configuration file if one is being used). 
More information: https://rev.cat/why-are-offerings-empty, readable_error_code=CONFIGURATION_ERROR}

Hi @Andy@smudge.io@Andrew Edwards 

Is this maybe the fix that it is now showing the error that is caused by the test environment of Apple?

I’d be happy to try it but could not make it clear to me how I should try it out in my flutter app. If necessary, I can surely try if you would be able to provide step by step instructions on how I should use this branch in the app.

Userlevel 5
Badge +8

@smudge.io I believe I should have been more clear as to what the fix does: it only introduces a timeout to ensure that the method at least returns a value. The real fix needs to come from Apple and go into the OS itself, so this timeout (plus some logs) is the best we can do in the meantime. 

From the notes in the summary post

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 getOfferingsreturns a value (an error, in the case of this bug).

 

We’ve heard some people report that this issue is fixed in iOS 15.1, but I can’t verify that since I don’t have an account that reproduces the issue in the first place. 

Thanks for testing!! 

Userlevel 5
Badge +8

@Sinecan Anhammer 

Is this maybe the fix that it is now showing the error that is caused by the test environment of Apple?

 

Exactly right, the fix is to actually produce an error instead of waiting forever for Apple to return a value. 

 

I’d be happy to try it but could not make it clear to me how I should try it out in my flutter app. If necessary, I can surely try if you would be able to provide step by step instructions on how I should use this branch in the app.

I’m working on propagating this fix to Flutter, I will keep you posted. Thanks for offering to test! 

Userlevel 1
Badge +3

Further information after building a demo project for Apple Feedback: FB9650399

When running the project as the original account in Settings | App Store | Sandbox Account and using the RevenueCat SDK, the product identifiers will only be returned the first time, until the device is rebooted. Using native StoreKit, also fails to return product identifiers after the initial RevenueCat SDK failure.

Using native StoreKit with the original account, it will consistently return product identifiers until the RevenueCat SDK is used, and then it will fail for both RevenueCat SDK and native StoreKit until reboot.

When running the project as a different account in Settings | App Store | Sandbox Account, after a reboot, the account consistently returns product identifiers using either RevenueCat or native StoreKit.

It seems as though something like a process is crashing when using the RevenueCat SDK, only when using the original account, that is not restarted until the iOS device is restarted.

Reply