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
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.
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!
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.
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â
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.
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