Hi
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,
Best answer by Andy
View originalHi
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,
Best answer by Andy
View originalIs 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:
Can you also link a test project containing your deserialization test code?
I am attaching a legitimate error I hope from one user, the user didn’t complain but I always get an attachment with the latest error and I thought to share it with you guys.
That’s perfect, I think
I am attaching a legitimate error I hope from one user, the user didn’t complain but I always get an attachment with the latest error and I thought to share it with you guys.
We’ll definitely will want to take a look at a few things related to your project setup/dependencies/platform support/etc.
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!
We are running into this issue as well. Somehow we can’t form the json response correctly.
```
😿‼️ Unable to instantiate SubscriberData from json object: ["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]
```
I just merged an update that will throw errors instead of returning `nil` in https://github.com/RevenueCat/purchases-ios/pull/937
I can’t release it to Beta just yet because we also just merged a large update that includes the beginning of StoreKit2 support and we need to test it a little bit more.
There is only 1 file to update if you wanted to build the SDK from the current beta tag with this.
guard let firstSeenDateString = subscriberData["first_seen"] as? String,
let firstSeenDate = dateFormatter.date(fromString: firstSeenDateString) else {
return nil
}
self.firstSeen = firstSeenDate
guard let originalAppUserIdString = subscriberData["original_app_user_id"] as? String else {
return nil
}
After you exit with nil, you call the logger. I can’t access the logger and pass it to you (If I can please let me know how I can ask users to do that) but the error object that I attached is the one I can pass to you. Is there a way you can add more info there so I can pass it to you? I debugged your code and of course I see everything fine.
Let me know how to proceed, my NSDate extension are not being called by your sdk.
I am guessing since this is a random thing, I saw empty CustomerInfo on my device from time to time, that this is not an SDK code that is causing it, it some garbage data coming from the server.
Happy to add any info if you think of any.
I think that’s a solid plan. I”ll check into this log and get back to you with anything I find.
Meanwhile, another log from the same user who can’t restore his purchases.
I was able to chase down the exact response that was sent when your customer encountered:
RevenueCat LastError: Error Domain=RevenueCat.ErrorCode Code=12 "Received malformed response from the backend." UserInfo={generated_by=<snip> getSubscriberData(appUserID:completion:), NSUnderlyingError=0x2823f5f50 {Error Domain=RevenueCat.UnexpectedBackendResponseSubErrorCode Code=8 "(null)" UserInfo={NSUnderlyingError=0x280c84c80 {Error Domain=RevenueCat.CustomerInfoError Code=1 "(null)"}
The json is ok and I can manually instantiate the objects with the exact response. I met with
“subscriberData["first_seen"]” is empty, or the date format is incorrect.
OR:
“subscriberData["original_app_user_id"]” is nil.
Both of these conditions were ok in the response!
So that leaves us with some questions: what other sdks do you current use? Do you have any of your own Date extensions that you’re using? The thought is that maybe you’re using an SDK that could:
1) swizzle some of the foundation date parsing stuff (we’ve seen it)
2) have the same named Date extension so runtime resolution of the extension is non-determinate.
We really appreciate you tracking this stuff down with us. At this point, I’ve added yet more error handling to a new pr, but I think something outside our control is going on since the exact json responses that are causing issues for you are not causing issues in my testing. If I could repro this, it would be so much easier 😔
Ooof, this new error is actually on Apple’s server. They do some weird stuff with errors that makes it difficult to fully understand what the problem is sometimes, but we have a thread open on it and are going to work on a workaround, you can follow along: https://github.com/RevenueCat/purchases-ios/issues/392#issuecomment-804996692
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=[:],activeSubscriptions=[:],nonSubscriptionTransactions=[],requestDate=2021-11-04 16:47:10 +0000,firstSeen=2021-11-04 16:47:09 +0000,originalAppUserId=U1625795716907644928,entitlements=[:]>RevenueCat LastError: (null)
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.
I’ve got one more Beta coming up (I hope today) that will add even more information to this error.
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.}
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.
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.
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?
Hey
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?
Enter your username or e-mail address. We'll send you an e-mail with instructions to reset your password.