Solved

iOS Bug: RCPurchases offeringsWithCompletionBlock offerings and error are both nil

  • 14 September 2021
  • 2 replies
  • 37 views

Badge

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.

icon

Best answer by taquitos 24 September 2021, 23:09

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

2 replies

Badge

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` 

Userlevel 1
Badge +1

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/

 

Reply