Solved

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

  • 22 October 2021
  • 69 replies
  • 929 views


Show first post

69 replies

Userlevel 3
Badge +8

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

Userlevel 3
Badge +8

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)

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 3
Badge +8

Here is my log from iPhone X which works fine.

Userlevel 3
Badge +8

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 6
Badge +8

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 3
Badge +8

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 +8

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

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 3
Badge +8

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

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 3
Badge +8

User reported same error for iOS 15.1

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

 

Userlevel 3
Badge +8

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

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 3
Badge +8

@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 3
Badge +8

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 3
Badge +8

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 3
Badge +8

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

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
 

Reply