Search Unity

DeObfuscate not implemented

Discussion in 'Unity IAP' started by Sherwinnie, Apr 15, 2021.

  1. Sherwinnie

    Sherwinnie

    Joined:
    Jan 24, 2020
    Posts:
    19
    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.
     
  2. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    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://forum.unity.com/threads/sample-iap-project.529555/#post-6950270
     
    Sherwinnie likes this.
  3. John_Corbett

    John_Corbett

    Joined:
    May 17, 2019
    Posts:
    151
    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.
     
    Sherwinnie likes this.
  4. Sherwinnie

    Sherwinnie

    Joined:
    Jan 24, 2020
    Posts:
    19
    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!
     
    ina, justtime and JeffDUnity3D like this.
  5. ina

    ina

    Joined:
    Nov 15, 2010
    Posts:
    1,085
    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?
     
    Last edited: Nov 2, 2021
  6. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Did you generate the tangle files? From the menu Services/In-App Purchasing/Receipt Validation Obfuscator
     
  7. ina

    ina

    Joined:
    Nov 15, 2010
    Posts:
    1,085
    "Error is The type initializer for 'UnityEngine.Purchasing.Security.GooglePlayTangle' threw an exception.
    Are the tangle files only for Google or also for Apple?
     
  8. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    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."
     
  9. ina

    ina

    Joined:
    Nov 15, 2010
    Posts:
    1,085
    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
     
  10. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    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

    TangleForTwo.png
     
  11. ina

    ina

    Joined:
    Nov 15, 2010
    Posts:
    1,085
    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.
     
  12. ina

    ina

    Joined:
    Nov 15, 2010
    Posts:
    1,085
  13. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    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"
     
  14. ina

    ina

    Joined:
    Nov 15, 2010
    Posts:
    1,085
    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:
     
  15. JeffDUnity3D likes this.
  16. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
  17. ina

    ina

    Joined:
    Nov 15, 2010
    Posts:
    1,085
  18. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    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.
     
  19. ina

    ina

    Joined:
    Nov 15, 2010
    Posts:
    1,085
    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?

    https://gyazo.com/4cffa279a3a6614a7d2db1874cbf5224
     
  20. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    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
     
  21. ina

    ina

    Joined:
    Nov 15, 2010
    Posts:
    1,085
    Hi I have gotten Unity IAP to work in earlier versions in 2017 or so - however, it just doesn't seem to work on device these days.

    "In-App Purchasing initialize failed: NoProductsAvailable"

    - Does the test app need to be submitted and approved by Apple for Testflight?
    - Do the IAP products need to be Ready to Submit or actually Submitted / Approved?
     
  22. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Yes, TestFlight on Apple and Closed (or Internal) Testing on Google. And Ready to Submit. https://docs.unity3d.com/Manual/UnityIAPGoogleConfiguration.html and https://docs.unity3d.com/Manual/UnityIAPAppleConfiguration.html
     
  23. ina

    ina

    Joined:
    Nov 15, 2010
    Posts:
    1,085
    Yes, I've reviewed that profusely. The screenshots are out of date by several years, though!

    Your documentation does not indicate that Apple needs to approve it for Testflight. Do I just upload it to Testflight for internal testing (done already), or does Apple have to review/accept it (waiting) for public Testflight?
     
  24. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
  25. ina

    ina

    Joined:
    Nov 15, 2010
    Posts:
    1,085
    Working on getting subscriptions to work on Apple first...

    Approved for public testflight. Still does not work.
    IAP products "Ready to Submit" for at least 24 hours (though not submitted)

    Debug log from Xcode installed
    https://pastebin.com/rp4Y2fay


    1. 2021-11-16 13:03:17.956060-0800 SampleIAPProject[2981:189422] UnityIAP: Requesting product data...
    2. 2021-11-16 13:03:18.437837-0800 SampleIAPProject[2981:189659] UnityIAP: Received 0 products
    3. 2021-11-16 13:03:18.443904-0800 SampleIAPProject[2981:189659] UnityIAP: No App Receipt found
    4. 2021-11-16 13:03:18.477367-0800 SampleIAPProject[2981:189422] UnityIAP: No App Receipt found
     
  26. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    @ina Do you have a product defined com.nusoy.iapsubscription.submonth on your Apple dashboard? If you do, have you filled out the Billing and Tax information? It is required. Are you testing as a TestFlight user? And no other meta or other warnings on your Apple dashboard? Just found this, looks pretty accurate and mentions the tax information. https://www.raywenderlich.com/5456-in-app-purchase-tutorial-getting-started
     
  27. ina

    ina

    Joined:
    Nov 15, 2010
    Posts:
    1,085
    Yes, all information has been filled out. Including tax information. Unity IAP from 2017 has been working and collecting consumables.

    The product has been setup at Ready to Submit. https://gyazo.com/4dae02151860a5daf49ed01bc60589b4

    Tried both as Testflight user and Xcode install.
     
  28. ina

    ina

    Joined:
    Nov 15, 2010
    Posts:
    1,085
    Ah I just realized that in the BuyingSubscription example, it's not the fully qualified dn but just the product name. So, changing product from com...submonth to just submonth - it seems to work, and this is just from a Xcode install (not Testflight). This was especially confusing because your example had
    public string subscriptionProductId = "com.mycompany.mygame.my_vip_pass_subscription";
    which should be just
    public string subscriptionProductId = "my_vip_pass_subscription";


    Next step: how does one handle the situation when a user upgrades to subyear (yearly subscription) from submonth (monthly) - how does one cancel the monthly subscription so the user does not get double billed?
     
  29. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    The name can be anything, that was just an example. If you define it as "com.mycompany.mygame.my_vip_pass_subscription" in your game, you need to define it the same way on your developer dashboard. Please open a separate thread for new questions.
     
  30. ina

    ina

    Joined:
    Nov 15, 2010
    Posts:
    1,085
    Regarding the deobfuscate, it seems subscriptions are working (on App Store Sandbox) but I have only entered the Google Play key in for obfuscation... Does the Apple key need to be entered anywhere (?)
     
  31. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    No, on Apple it's not needed.