Solved

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

  • 22 October 2021
  • 69 replies
  • 926 views


Show first post

69 replies

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

Userlevel 3
Badge +8

@taquitos And anything I should be doing on my side of the code?

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

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

Userlevel 3
Badge +8

I installed Beta.8 and played with it on my device.  After many launches on my device, I get an instance where customerInfo has no entitlements and no error (I do have some entitlements).  After the app quit and relaunch, the entitlements came fine.  I am releasing the app anyway, pending Apple approval now.

One of the users told me that Restore Purchases didn’t work for him, attached is his error, I told him to change to region to USA, his region was some where in Netherland, after he changed the region, the Restore worked fine.

Will keep you updated...

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

@Winston Du @taquitos @cody just to let you know that the issue still happens, users must restore purchases from time to time.  For those users who can’t restore, when they change region to USA l, restore starts to work.
Please see latest log from a user in my previous message. 
my users who don’t know what is going on are leaving reviews that I am asking for purchases that they already paid for, nasty reviews and I can’t blame them.  Sad this issue is going on for months now, I am sadly thinking of using another in-app SDK.
 

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,

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

User reported same error for iOS 15.1

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

 

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

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

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

Here is my log from iPhone X which works fine.

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

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

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

Userlevel 6
Badge +8

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

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

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

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?

Userlevel 3
Badge +8

Thanks @Jacob Eiting, I am happy to put as much time in this issue and code to highlight what is going on.  I like your company echo system but it is now something that is killing my app reputation.  The frequency of restore can be every day. I use my app and it happens to me every week or so, no pattern I can report, some users reports daily.  The main issues are:-

  1. Customer info comes nil from time to time, random.
  2. some users get errors and I attached the error details along this thread. 

Happy to put any code for future release to help find the root issue.  It started to happen after iOS 15 for sure, before that, customer info was always ready and valid. 

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

@imougy and @Winston Du could both of y’all open a ticket for us at https://app.revenuecat.com/settings/support ? This is going to require some deeper digging, and having a ticket gives us a secure place to do that where you can share project code without worrying about exposing it to the public.

We’ll definitely will want to take a look at a few things related to your project setup/dependencies/platform support/etc. 

@imougy I’m currently baffled. I took one of the requests that are in your logs and the SDK had no issue parsing it. I think if we can test parsing and creating a CustomerInfo in your project from raw json, that might help us figure out what is going on. For example in your attached “log2.txt” I looked up the exact response we sent you from the server. I copied that into a test file and then loaded that the exact way our SDK does it. I expected the CustomerInfo parsing to fail the same way you are seeing it. That didn’t happen 😖 

 



 

Reply