Question

Randomly and false-zero-Entitlements returned from purchaseProduct:withCompletion

  • 22 October 2021
  • 36 replies
  • 279 views

Userlevel 2
Badge +4

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,

 


36 replies

Userlevel 1
Badge +1

Digging into this, it looks like “The data couldn’t be read because it is missing” doesn’t tell the whole story, there might be some bad json/missing values/keys etc. I have a PR up to improve our decode error handling:
https://github.com/RevenueCat/purchases-ios/pull/919
 

Userlevel 2
Badge +4

Also, I released the app today to everyone. Will report if anyone is having issues. 
Thank you for following up!

Userlevel 2
Badge +4

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. 

Userlevel 2
Badge +4

The same user is locked out from the app.  He sent me email today with the errors:-

His user ID is: F6862686180809447439

Thanks,

Ilam

Userlevel 2
Badge +4

@taquitos I saw the change of code to report better text.  Please let me know if I should get a new beta, I am currently on Beta.3

Also, is there a way to track down this user and see what is going on there? It might solve the whole issue.  I know for sure two things happening:-

  1. Randomly, the completion of purchaserInfo is not called (because if this ever happens I open up all the features and I lose money of course) and this user reported that he can see all the features unlocked randomly.
  2. Randomly, he gets totally locked out and all his purchases are not there even if he does Restore Purchase.

This is really very bad as you can imagine and I am puzzled it is happening only to my apps and no other clients of yours!  I am already looking for alternative SDKs, it has been over a month and I don’t see any progress.

Thanks,

Userlevel 1
Badge +1

I’m still working on refining the error code change, but when it’s ready I definitely think using that would be helpful. Right now, @cody is helping me chase down these issues, too (cc’ing for visibility). He can help with potentially chasing down this specific user.

We are seeing similar issues that are just fromStoreKit in iOS 15 (which have been fixed in 15.1) For example: https://developer.apple.com/forums/thread/688416

One quick note about the Beta, next beta we’re renaming “Purchaser” to “Customer”. That means all API that starts with “purchaser” will change to “customer”. We used `@available` annotations so Xcode should auto-correct.

Userlevel 2
Badge +4

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

Userlevel 2
Badge +4

User reported same error for iOS 15.1

This error happens when Restore Purchases button is pressed (one call to the API).

 

Userlevel 1
Badge +1

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. 

Userlevel 2
Badge +4

@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. 

Userlevel 1
Badge +1

purchaserInfoWithCompletion with RCPurchaserInfo=null

 

Ahh yes, now that we’re 100% Swift, that one has been updated… there are cases where it’s expected that it will be nil, so the API has been updated to:

`getCustomerInfo(completion: @escaping (CustomerInfo?, Error?)`

It can be nil when the cache has been cleared (UserDefaults is currently how we cache things, so if you clear UserDefaults, you might run into it), or if an error returned from the backend. Luckily, we have much better logging around those cases 😄 

Userlevel 2
Badge +4

I don’t clear the UserDefaults for sure. 
can’t wait for the beta 5 to be released, I will update you after that. 

Userlevel 2
Badge +4

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.}

Userlevel 3
Badge +7

Hey @imougy!

Do you by chance have the full debug logs for the user, or is this just the error object itself that we are returning when fetching CustomerInfo?

Userlevel 2
Badge +4

I planted code that gets me the last RevenueCat error and user must send me email within the app so I can see it.  I can do whatever, please let me know what other info you like me and how to fetch them and I will make a new release for that. 
min my next reply, I will attach debug log for my device that works fine.

Userlevel 2
Badge +4

Here is my log from iPhone X which works fine.

Userlevel 1
Badge +1

I’ve got another change up that further surfaces errors and includes more data in the Error object that we can inspect. I’m going to let it bake overnight (and let the team code-review it) and add some extra tests tomorrow.

Userlevel 2
Badge +4

Fyi, when I opened the app right now, on my iPhone X, it shows I didn’t buy anything (not true) and here is the customerInfo and error returned:-

<CustomerInfo:
originalApplicationVersion=,
latestExpirationDate=nil,
activeEntitlements=[:],
activeSubscriptions=[:],
nonSubscriptionTransactions=[],
requestDate=2021-10-29 06:25:27 +0000,
firstSeen=2021-10-29 06:25:27 +0000,
originalAppUserId=U9646471015825905572,
entitlements=[:]
>
RevenueCat LastError: (null)

Userlevel 2
Badge +4

I also know that those issues started after iOS 15, I am 100% sure about this. 

Userlevel 3
Badge +7

Hey @imougy!

I took a look in our logs, and see that this user ID was actually created new, which is why the customer info was empty- because technically, at that time, there wasn’t any transactions associated with it. It looks like you then restored purchases and this user ID was re-aliased with the other IDs sharing that receipt. Did you delete the app then reinstall and open it back up? I do see that this user ID has a lot of IDs associated with it.

I’m leaning toward there possibly being something odd going on with the way users are being identified for this particular case this morning- can you walk me through how you’re identifying users in your app(s)? Are you calling `reset` anywhere, or generating different user IDs at some point in your lifecycle?

Userlevel 2
Badge +4

So every user on any device has a unique user id, even if they delete and reinstall on the same device.  If they install on different device, it is different users. 
I do not call rest at all and I do not change the user id at all, given that the user didn’t change the device. 
This user have another device with older version of my app that seems to work, I will check his iOS version.  This use also seem to be the only one who can’t Restore purchases at all even after tapping on the Restore Button, he always gets the error in the snapshot attached previously. 
I asked him to give us any clue but I know he has many aliases because probably many devices. 
do you want me to add any code that help you? 

Userlevel 2
Badge +4

I checked with the user who can’t restore purchases after manually tapping on the Restore Purchases button and he mentioned he changed his Apple ID! So please let us focus on the main issue and not that particular user.  The main issue is, randomly, and I am sure it started with iOS 15.0 and still in 15.1, the RCCustomerInfo returned empty but after restore they get their purchases. 
If you need me to add any code to help with the issue please let me know. I know for example my iPhone X gets empty entitlement from time to time, happy to add any special code to expose what you want. 

Userlevel 2
Badge +4

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.  

Userlevel 2
Badge +4

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.}

 

Userlevel 1
Badge +1

I’ve got one more Beta coming up (I hope today) that will add even more information to this error.

Reply