Skip to main content

Hi @taquitos  With the latest 4.0.0-Beta.3, the return from purchaseProduct:withCompletion can have zero entitlement even though it is not true.

I can’t reproduce while in debug mode (randomly happens outside the debugger).

Attached is a txt file with a log of successful return (I see some errors but not sure how to cancel them).

Thanks,

 

I am thrilled to write this.  Since relocating the initialization to the root view controller there was zero incident of nil customerInfo.  @Andy, I can’t thank you enough for the 20 minutes code review, I wouldn’t have done it without it.

Please update the documentation to enforce this, otherwise apps will get in trouble for sure  

I will close the issue in few days, just because the majority of Stocks Live users will upgrade this week. 
@Andy and the rest of the team @cody, @taquitos, @Jacob Eiting, you guys are awesome, thank you so much for your time and experience, RevenueCat is one of the best companies I have ever worked with and of course it is because of the people and the founders. 


For anyone reading this, @imougy and I had a live session and we’re currently suspecting that the underlying issue might be the change in pre-warming behavior in iOS 15, and it’s related bugs: 

 

As for ways of working around this, it seems like the suggested approach is to move the SDK configuration to the initialization of the root VC. 

I’d also advise to move related code (like reading from the keychain), for the same reason. 

It was a pleasure chatting with you @imougy! Hope this helps, and definitely let me know how it goes! 


I am closing the issue, never been so excited about a bug being crushed. 
you guys rock. 
@Andy warm hugs 🤗 


This is awesome @Andy , thank you so much for your time and your suggestion.  I am making a release now and I feel good about it.  I am moving the initialization of the SDK to the root controller (instead of didFinishLaunchingWithOptions).

I will report back after one week to gather more data.

🙏

 


@taquitos 

 

We are running into this issue as well. Somehow we can’t form the json response correctly.

 

```

😿‼️ Unable to instantiate SubscriberData from json object: s"original_application_version": <null>, "non_subscriptions": { }, "first_seen": 2021-12-08T21:59:55Z, "original_purchase_date": <null>, "subscriptions": { }, "other_purchases": { }, "original_app_user_id": $RCAnonymousID:c8cab3a9cb4648d8828449e29194817d, "management_url": <null>, "entitlements": { }, "last_seen": 2021-12-08T21:59:55Z]

```


The user came back and mentioned he didn’t change the user ID (he changed his user name).  I confirmed that he has two devices, iPad and iPhone, both running iOS 15.1 and same version of the app, same Apple ID, on the iPhone, he can’t restore, he gets errors, on the iPad he can restore.  


Users have the latest iOS 15.2. I am one of them. 


Here is the error I got from the user above after installing Beta5. 
RCCustomerInfo: (null)
RevenueCat LastError: Error Domain=RevenueCat.ErrorCode Code=12 "Unable to instantiate a CustomerInfoResponse." UserInfo={readable_error_code=UNEXPECTED_BACKEND_RESPONSE_ERROR, NSUnderlyingError=0x28168af30 {Error Domain=RevenueCat.UnexpectedBackendResponseSubErrorCode Code=7 "(null)"}, NSLocalizedDescription=Unable to instantiate a CustomerInfoResponse.}


@taquitos , Awesome, I will include it in the next update this Friday and keep you posted.

I also like to add that sometimes I get purchaserInfoWithCompletion with RCPurchaserInfo=null and it shouldn’t. 


Sounds great, I will let the user upgrade to iOS 15.1 and keep you in touch. 


Ok, just released Beta 5 https://github.com/RevenueCat/purchases-ios/releases/tag/4.0.0-beta.5
I think this should really help us home in on what is going on. 


Just got those from a user with the latest 4.0.0-beta.3 

hope it give you any clue on what is happening.

the user reported that things are fine now after Restoring Purchases. 


@imougy I’ve made a branch called fix/name_conflicts_on_foundation_extensions, which adds a prefix to every single internal extension in our SDK, to make absolutely sure that no conflicts can happen. 

 

If you have a way to reproduce this issue, would you mind giving the branch a shot to see if it solve it? 


@imougy update here: I found a few extensions where we’re not adding prefixes or necessarily disambiguating our extensions from others, which might cause conflicts. 

I’m going to work on an update to remove all ambiguity, which might solve it. 

Would you be willing to give it a shot when I’m done? 

Also, have you found any way to consistently reproduce this? Perhaps by changing regions on your device? 

And yes, having some information on the date extensions would be super helpful. Also, if you have any extensions on date formatters in particular, since those seemed to be the conflict with DataDog’s SDK. 

 


@taquitos

Is there a place in the latest sdk release that logs the json in full utf8? (We only are logging the swift dictionary object right now...)
 

The failure I have is at:

https://github.com/RevenueCat/purchases-ios/blob/aa18f434441b7e59e30a49810f0d9e3284b1873c/Purchases/Public/CustomerInfo.swift#L181


Can you also link a test project containing your deserialization test code?


Latest error from user (F6862686180809447439), note that CustomerInfo is nil

App:CustomerInfo: (null)RevenueCat LastError: Error Domain=RevenueCat.ErrorCode Code=12 "Unable to instantiate a CustomerInfoResponse." UserInfo={readable_error_code=UNEXPECTED_BACKEND_RESPONSE_ERROR, NSUnderlyingError=0x283ee5d10 {Error Domain=RevenueCat.UnexpectedBackendResponseSubErrorCode Code=7 "(null)"}, NSLocalizedDescription=Unable to instantiate a CustomerInfoResponse.}

 


Took a little longer than expected, but here’s a new release: https://github.com/RevenueCat/purchases-ios/releases/tag/4.0.0-beta.6

We now add a lot more info to the error objects that get surfaced through the API.


@taquitos Sounds great, I am building now and hopefully release asap.


@taquitos here is the latest error attached from the same user, kind enough to keep posting us, with the latest beta.6

Today, I open the app on my device and I got no in-app at all and here is my log (Restore purchases work):-

CustomerInfo: <CustomerInfo:originalApplicationVersion=,latestExpirationDate=nil,activeEntitlements=s:],activeSubscriptions=s:],nonSubscriptionTransactions=s],requestDate=2021-11-04 16:47:10 +0000,firstSeen=2021-11-04 16:47:09 +0000,originalAppUserId=U1625795716907644928,entitlements=s:]>RevenueCat LastError: (null)

Adding two more log files with detailed errors.

Guys, this issue is frustrating to everyone.  Is there a way you connect with Apple to see what is going on?  I can connect with Apple as part of my development benefits but I don’t know how to follow up if they ask detailed questions (I didn’t write the code so I have no idea what is going on)!

It is still surprising to me that not all developers having the same issue, makes me wonder if there is a best practice I need to follow?  I don’t mind sharing the code that is responsible for the integration, I know the code was working and started to break just recently but maybe this can help?  If you are interested please let me know.

 

Again, thank you and Apple really suck!


@Winston Du good questions.  I get those logs that I posted by saving the error code in memory and when users contact me I embed those error codes so I can see what is going on.  It will be great if there is an api we call to get the internal state of the SDK so we can pass it along. 


@Winston Du  and @imougy I’ve made a tag and the release is happening. Should be done within the next 30 minutes 🎉
https://github.com/RevenueCat/purchases-ios/releases/tag/4.0.0-beta.8

If you’re using SPM, you should be good to go now 😄 Thank you @Winston Du for the assist!


Hey @imougy,

 

Firstly, thanks for being so helpful on this issue. Software is hard and it’s always nice when we’re working with folks share so much detail. 

 

The issue was brought to my attention today as part of a broader push to improve the tools we have for helping debug tricky issues like this. 

 

> users must restore purchases from time to time

Not sure how frequent this is, but I think it’s a pretty normal ticket and not always indicative of an issue. If a customer switches devices for example, or changes App Store accounts. Not saying there isn’t something further going on, but even a perfect implementation will generate some background noise level of these. 

 

The error log is still abnormal and we’re working the problem. Sorry about the whole thing. At this stage, we might be able to investigate further if we could pair debug with you. Would you be open to that if we set up some time with an engineer?


@Winston Du in my app, I myself get affected from time to time, I get empty customerInfo and need to restore purchases.  I have US local.  The randomness of the issue is a puzzle to me, unless some dates are parsed and others are not!

Anyway, I am eagerly awaiting any fix to test.

@Winston Du  Thanks for the follow up and I hope I can report good news when I get this change. @taquitos please keep me in touch so I can get this change.


@imougy I’m so glad to hear that! What a great way to start the week! 😃 I’m so happy we could help!

 

We’ll get the docs updated, hopefully we’ll save others from running into the same thing.

Thanks so much for your patience and help in figuring out what was going on! 

Don’t hesitate to get in touch again if you need any further assistance! 

 


Reply