Skip to main content
Solved

iOS Bug: RCPurchases offeringsWithCompletionBlock offerings and error are both nil

  • September 14, 2021
  • 3 replies
  • 125 views

Forum|alt.badge.img+6

We noticed some unusual behavior. This seems to happen when there is no clear error and we are unsure if this was intended or not. Consider the following code:

 

[[RCPurchases sharedPurchases] offeringsWithCompletionBlock:^(RCOfferings* offerings, NSError* error)
{
	if (offerings.current)
	{
		...
	}
	else if (error)
	{
		...
	}
	else
	{
		// this branch actually gets executed!
		...
	}
}];

Both offerings.current and error are nil in some cases. Usually it has something to do with running on iOS simulator or when the IAPs aren’t setup properly (which can be seen in the logs), but the implication in the call is that error will never be nil. Luckily we were able to identify this issue quickly and patch our code with a workaround, but maybe the SDK team might want to revise that behavior.

 

We haven’t tested  if other calls have the same issue or if other platform SDKs have it.

Best answer by Anonymous

Ohhh no.
Yeah, that’s weird. Thank you for reporting!

We recently migrated all our objc to swift, and we definitely found areas where we didn’t handle every possible case- so that’s to say, I think this is fixed, at least in the beta.

If you’re feeling adventurous, you could give our new release a try:  https://github.com/RevenueCat/purchases-ios/blob/main/docs/V4_API_Updates.md
We recently updated it to `4.0.0-beta.3` 

View original
Did this post help you find an answer to your question?
This post has been closed for comments

3 replies

  • 0 replies
  • Answer
  • September 24, 2021

Ohhh no.
Yeah, that’s weird. Thank you for reporting!

We recently migrated all our objc to swift, and we definitely found areas where we didn’t handle every possible case- so that’s to say, I think this is fixed, at least in the beta.

If you’re feeling adventurous, you could give our new release a try:  https://github.com/RevenueCat/purchases-ios/blob/main/docs/V4_API_Updates.md
We recently updated it to `4.0.0-beta.3` 


Andy
RevenueCat Staff
Forum|alt.badge.img+8
  • RevenueCat Staff
  • 237 replies
  • September 27, 2021

Hi!! Thanks for reporting!!

We’ve confirmed the issue and made a fix, it’s currently waiting for review and we’ll get it out the door soon.

https://github.com/RevenueCat/purchases-ios/pull/879/

 


Andy
RevenueCat Staff
Forum|alt.badge.img+8
  • RevenueCat Staff
  • 237 replies
  • October 1, 2021

Quick update here:

The fix has been deployed in release 3.12.6, and also to our v4 beta. If you’re using our beta builds, you can point to the `main` branch of `purchases-ios` to get it.

Now, if no offerings can be created from the data in the backend (either because there are no products in App Store Connect, or you’re running in the simulator, or well, there are no offerings in the backend), the method will return an error with a helpful message, including links to documentation to fix the issues.

Thanks once more for reporting this! And please let us know if you run into any other unexpected behavior in the future!!


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings