Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

receipt Null Reference Exception in live build

Discussion in 'Unity IAP' started by ooblii, Jun 26, 2017.

  1. ooblii

    ooblii

    Joined:
    Feb 23, 2013
    Posts:
    30
    I've gotten this a couple times since the game went live on Saturday:

    NullReferenceException: A null value was found where an object instance was required.

    UnityEngine.Purchasing.Security.AppleReceiptParser.ParseReceipt (LipingShare.LCLib.Asn1Processor.Asn1Node data)
    UnityEngine.Purchasing.Security.AppleReceiptParser.Parse (System.Byte[] receiptData, UnityEngine.Purchasing.Security.PKCS7& receipt)
    UnityEngine.Purchasing.Security.AppleReceiptParser.Parse (System.Byte[] receiptData)
    UnityEngine.Purchasing.AppleStoreImpl.OnProductsRetrieved (System.String json)
    UnityEngine.Purchasing.AppleStoreImpl.ProcessMessage (System.String subject, System.String payload, System.String receipt, System.String transactionId)
    UnityEngine.Purchasing.Extension.UnityUtil.Update ()


    Any help would be greatly appreciated.

    IAP version 1.11.2
     
    Last edited: Jun 26, 2017
  2. ap-unity

    ap-unity

    Unity Technologies

    Joined:
    Aug 3, 2016
    Posts:
    1,519
  3. ooblii

    ooblii

    Joined:
    Feb 23, 2013
    Posts:
    30
    @ap-unity

    Thanks for responding. I'm using Collaborate to sync the project from my main PC over to my Mac for the iOS build. I remember that at one point Collab complained on syncing to the Mac that the Tangle being pulled was different than what was on the local machine; can't remember if I accepted or rejected the change. I'm guessing the Tangle on the Mac was generated on the PC without the root certificate from the Mac. What would be the best way to remedy this? Obfuscating secrets on the Mac again?

    update: After reading the docs a bit more it seems like it doesn't matter if secrets are obfuscated from the mac. Here's what I've done to try to sync everything. Please let me know if this seems off:

    Updated Unity IAP to the latest version on both machines.
    Deleted both tangles on the PC and re-obfuscated secrets with the Google Play key on the PC.
    Published the changes to Collab.
    Deleted the tangles from the Mac, and pulled in the new tangles.

    Collab on the Mac again complained about the new Tangles, but I selected "Choose Theirs" to accept the new Tangles from the PC.

    Does that seem like a proper way to fix the issue?
     
    Last edited: Jun 27, 2017
  4. ap-unity

    ap-unity

    Unity Technologies

    Joined:
    Aug 3, 2016
    Posts:
    1,519
    @ooblii,

    After discussing this issue more with the IAP team, it sounds like it is unrelated to the Tangles. Though the Tangles will be different each time they are generated (which would cause a conflict), they should both work, so it shouldn't matter which you choose to use.

    Here is the conversation from one of our engineers:

    • Are you able to verify the contents of the receipt before it goes into the Cross Platform Validator?
    • Is it possible that the receipt is getting corrupted or truncated somehow?
    • Would you be able to share a copy of your purchase script?
     
  5. ooblii

    ooblii

    Joined:
    Feb 23, 2013
    Posts:
    30
    @ap-unity

    I'm using the plugin EasyMobile purchased from the asset store to handle the IAP, so we would need to go to a more secure channel to share code. Or, I imagine, you'd have ways of accessing it.

    I have a feeling that it may be from people trying to tamper with the receipt. The amount of Pre-Verified Revenue in the analytics dashboard far outstrips anything being reported in iTunes Connect.

    I'll contact SgLib Games (maker of EasyMobile) to see what their thoughts are.