DeObfuscate not implemented

I upgraded my IAP from previous version to 3.0.2 (showing 3.0.1 in project, but Package Manager says 3.0.2). It was working fine before, but I want to make sure I upgraded it int time. However, when I make the validater from AppleTangle and GoogleTangle, it throws a DeObfuscate Not Implemented Error. I looked into the source code, and sure enough it does throw a Not Implemented Error. I downloaded the sample project and check how to use Validation with the new version. However, in the sample project, DeObfuscate is implemented, and now I am…just kind of confused.

So, what can I do now?

ps. I know someone already asked a similar problem, but that thread…was not very helpful.

This is expected if you are running in the Editor. You just need to use a Try/Catch block. There is an example in the Sample IAP Project v2 https://discussions.unity.com/t/700293/3

1 Like

Hi @Sherwinnie

Just to clarify, that exception you see is normal on any non-Google, non-Apple platform. We don’t support it on other platforms nor in-Editor Play Mode.

Jeff’s proposed solution is what I’d recommend. You don’t need to do anything in the Exception catch block.

1 Like

I can see the reason why it is currently it is done the way it is now. However, I just feel like this is an overkill. Instead of having to use try catch block whenever I call the function, as a user, I would much rather have the function prints something to the console, notifying it will work as normal in Apple or Google platform, but always return true in-Editor.

It’s just…if I have to use try-catch block every time I use the function, then I think it is against the design purpose of a try-catch block in the first-place. In my understanding, try-catch block is for situations where the function may or may not work in the run-time, not for functions we know 100% will fail in-Editor, but 100% will work in Build, since the function is actually working “normally.” Plus, it is just an extra step to go through. I think in the future, someone will definitely ask the same question here again, since this change isn’t really documented in code or anywhere, nor is it very intuitive.

Just my thought though, thanks for providing an answer!

3 Likes

Still getting this error “Error is The type initializer for ‘UnityEngine.Purchasing.Security.GooglePlayTangle’ threw an exception.”

upon attempting to purchasing even the defaults

Does the example include the Try Catch for editor testing?

Did you generate the tangle files? From the menu Services/In-App Purchasing/Receipt Validation Obfuscator

"Error is The type initializer for ‘UnityEngine.Purchasing.Security.GooglePlayTangle’ threw an exception.

Are the tangle files only for Google or also for Apple?

You answered a question with another question. Are you at your computer? Did the error go away when you generated the tangle files? From the documentation: “This window encodes both Apple’s root certificate (which is bundled with Unity IAP) and your Google Play public key (from the application’s Google Play Developer Console’s Services & APIs page) into two different C# files: AppleTangle and GooglePlayTangle.”

Okay this is super confusing since this IAP menu in Unity editor only asks for a public key from Google Play Console. Also it does not mention it generates the AppleTangle. Also I don’t think this is documented either, or at this point, I’m not sure where the current documentation is

The link to the documentation is in your own reply to my message, the link in blue. I’ll post here again. It’s now under Services, as mentioned above.

https://docs.unity3d.com/Manual/UnityIAPValidatingReceipts.html

7626538--948892--TangleForTwo.png

In the IAP sample, I’m not able to get ProcessPurchase to work to do receipt checking. It keeps catching -

Error is The method or operation is not implemented.

Can you update that so it also mentions Apple?
Also, what if one isn’t planning on releasing for Google?

Yes, the updated docs will also mention Apple. The receipt validator will work on either platform, or just one, using the same steps. The classes are still generated if you leave out the Google key, try it! Always make a project backup, then try anything you want, no need to keep asking here. If you are running in the Editor, you’ll need a Try/Catch block. Please see the IAP Sample in Package Manager “05 Local Receipt Validation”

Where can I find 05 Local Receipt Validation?

I tried the github link above, which does not contain that

I just downloaded the latest IAP in Package Manager and this is all it contains - no 05 Local Receipt:

You haven’t disclosed what Unity version you’re using, I see this in 2021.2.
If you can’t see this version in the package manager, you can always install packages manually: https://docs.unity3d.com/Packages/Installation/manual/upm-ui-quick.html or the Add package by name if your Unity version already has that.
7630870--949720--screenshot.png

1 Like

@ina The latest IAP is 4.1.0 Unity IAP package 4.12.2 is now available page-2#post-7582816

I was using iap 3.2.3 which is listed as verified for 2020.3.17f1
I see 4.1.1. is out but it is not listed as verified

Please see the note at the link mentioned regarding verified. You could install the latest version just to get the code mentioned, it will still work with earlier versions.

Hi Jeff, so I grabbed the latest IAP 4.1.0 sample on Unity 2020.3.17f and read the IAP setup. I’m still at a lost as to how to get subscription to work.

02 Buying Subscription - I have “submonth” configured in Apple AppStoreConnect’s IAP, obfuscator, and the IAP Catalog in Unity editor, but I can’t seem to have this example point to anything but the fake store?

Also, it seems in 4.1.0’s obfuscator editor UI, it still seems to indicate only Google Play and not Apple?

I might suggest to actually publish the Sample IAP Project first and get the basics working. Also your app will only connect to Apple store when you run on an Apple device, not in the editor. You would want to publish through TestFlight to test IAP on iOS, see the documentation here https://docs.unity3d.com/Manual/UnityIAPAppleConfiguration.html . If you’re stuck with receipt validation, then temporarily ignore that feature, and get the rest of IAP working. Once IAP is working and you can make test purchases, then it’s easy to add receipt validation https://docs.unity3d.com/Manual/UnityIAPAppleConfiguration.html