Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Voting for the Unity Awards are OPEN! We’re looking to celebrate creators across games, industry, film, and many more categories. Cast your vote now for all categories
    Dismiss Notice
  3. Dismiss Notice

[Solved] Unity Codeless IAP iOS works in a development build but not in a release build

Discussion in 'Unity IAP' started by denischernitsyn, May 7, 2018.

Thread Status:
Not open for further replies.
  1. denischernitsyn

    denischernitsyn

    Joined:
    Apr 24, 2013
    Posts:
    15
    Hello,

    I'm using Unity Codeless IAP, added product IDs on Testflight and when I prepare a development build, I can see all of the subscriptions I created and normally can purchase, consume and restore it.

    But when I create a release build and upload it to Testflight, I get an error:

    UnityIAP UnityEarlyTransactionObserver: Request to initiate queued payments
    NullReferenceException: A null value was found where an object instance was required.

    This error appears, when I start the app. And when I try to purchase a product, I get a ProductUnavailable failure reason.

    Has anyone faced it?

    Thanks in advance.

    Unity 2017.2.0p4
    Unity IAP 1.18.0

    A more specific log:
    Code (CSharp):
    1.  
    2. Unloading 3 unused Assets to reduce memory usage. Loaded Objects now: 11938.
    3. Total: 11.159625 ms (FindLiveObjects: 0.520583 ms CreateObjectMapping: 0.874000 ms MarkObjects: 9.603166 ms  DeleteObjects: 0.161416 ms)
    4.  
    5. 2018-05-10 21:46:05.302170+0300 myapp[986:412676] UnityIAP:Received 8 products
    6. 2018-05-10 21:46:05.304651+0300 myapp[986:412676] UnityIAP:No App Receipt found
    7. 2018-05-10 21:46:05.308060+0300 myapp[986:412676] UnityIAP:No App Receipt found
    8. 2018-05-10 21:46:05.308711+0300 myapp[986:412676] UnityIAP:Add transaction observer
    9. 2018-05-10 21:46:05.308744+0300 myapp[986:412676] UnityIAP:UpdatedTransactions
    10. 2018-05-10 21:46:05.308790+0300 myapp[986:412676] UnityIAP:No App Receipt found
    11. .... UnityIAP:No App Receipt found is copied a thousand times here.
    12. 2018-05-10 21:46:05.340451+0300 myapp[986:412676] UnityIAP:No App Receipt found
    13. 2018-05-10 21:46:05.340475+0300 myapp[986:412676] UnityIAP UnityEarlyTransactionObserver: Request to initiate queued payments
    14. NullReferenceException: A null value was found where an object instance was required.
    15.   at Facebook.Unity.Mobile.IOS.IOSFacebook.MarshallDict (System.Collections.Generic.Dictionary`2 dict) [0x00000] in <filename unknown>:0
    16.   at Facebook.Unity.Mobile.IOS.IOSFacebook.AppEventsLogEvent (System.String logEvent, Nullable`1 valueToSum, System.Collections.Generic.Dictionary`2 parameters) [0x00000] in <filename unknown>:0
    17.   at FacebookAnalyticsSystem.SendEvent (System.String eventName, .AnalyticsParameter[] parameters) [0x00000] in <filename unknown>:0
    18.   at System.Collections.Generic.List`1[T].ForEach (System.Action`1 action) [0x00000] in <filename unknown>:0
    19.   at UnityEngine.Events.UnityEvent`2[T0,T1].Invoke (.T0 arg0, .T1 arg1) [0x00000] in <filename unknown>:0
    20.   at Monclarity.HNP.AnalyticsEventWithParameters.Raise () [0x00000] in <filename unknown>:0
    21.   at UnityEngine.Events.UnityEvent.Invoke () [0x00000] in <filename unknown>:0
    22.   at Iridescent.Core.InAppManager.PurchaseCompletedAction (UnityEngine.Purchasing.Product product) [0x00000] in <filename unknown>:0
    23.   at UnityEngine.Events.UnityEvent`1[T0].Invoke (.T0 arg0) [0x00000] in <filename unknown>:0
    24.   at UnityEngine.Purchasing.IAPButton.ProcessPurchase (UnityEngine.Purchasing.PurchaseEventArgs e) [0x00000] in <filename unknown>:0
    25.   at UnityEngine.Purchasing.IAPButton+IAPButtonStoreManager.ProcessPurchase (UnityEngine.Purchasing.PurchaseEventArgs e) [0x00000] in <filename unknown>:0
    26.   at UnityEngine.Purchasing.PurchasingManager.ProcessPurchaseIfNew (UnityEngine.Purchasing.Product product) [0x00000] in <filename unknown>:0
    27.   at UnityEngine.Purchasing.JSONStore.OnPurchaseSucceeded (System.String id, System.String receipt, System.String transactionID) [0x00000] in <filename unknown>:0
    28.   at UnityEngine.Purchasing.Extension.UnityUtil.Update () [0x00000] in <filename unknown>:0
    29. (Filename: currently not available on il2cpp Line: -1)
    30.  
    31. Unloading 1 Unused Serialized files (Serialized files now loaded: 0)
    32.  
    33. Unloading 0 unused Assets to reduce memory usage. Loaded Objects now: 12202.
    34. Total: 10.241416 ms (FindLiveObjects: 0.500875 ms CreateObjectMapping: 0.241458 ms MarkObjects: 9.473708 ms  DeleteObjects: 0.024916 ms)
    35.  
    36. Unloading 3 Unused Serialized files (Serialized files now loaded: 0)
    37. UnloadTime: 0.971958 ms
    38.  
    39. Unloading 1 unused Assets to reduce memory usage. Loaded Objects now: 12593.
    40. Total: 10.263041 ms (FindLiveObjects: 0.671916 ms CreateObjectMapping: 0.248541 ms MarkObjects: 9.304000 ms  DeleteObjects: 0.038041 ms)
    41.  
     
  2. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    @reavenheart Do you have a thousand receipts for this user, or are the repeated messages in error? Are you downloading the test app via TestFlight or side loading/running from XCode? And by "release" build, you mean a test app, but that you did not check "Development Build", correct?
     
  3. denischernitsyn

    denischernitsyn

    Joined:
    Apr 24, 2013
    Posts:
    15
    Thank you for your response, JeffDUnity3D

    Thousand repeated messages is caused because there were a lot of test purchases made on a device. And Unity IAP recovers them all the time. With all of their receipts.

    This issue appears as from TestFlight builds, so as direct XCode builds.
    And yes. Release in my case means that "Development Build" check box is disabled.
     
  4. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    Does this reproduce when you use a new user on the device (with no receipts)? It may be an edge case with Unity IAP with so many receipts that would never happen in a production application. Were you doing load testing perhaps that required so many tests?
     
  5. denischernitsyn

    denischernitsyn

    Joined:
    Apr 24, 2013
    Posts:
    15
    It happens with any type of the user. I also created a new Apple account to verify if it happens with a clean one. Just the IAP doesn't receive any products and all of them are unavailable. But if it was an Apple ID account issue, it should be reproduced in a development build on certain accounts. But it works absolutely fine on all of the test accounts. And I can get normal receipts and answers from Apple

    No. It has been no load testing. We just tested it as usual. Just a lot of subscriptions were made.
     
  6. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    No I didn't imply an account issue, but rather a possible initialization issue with thousands of receipts. So a development build initializes, but a non-development build does not initialize for a brand new user (with no receipts)? You've never got a non-dev build working? I just tested here and unchecked Development Build, installed directly on my phone from XCode (previously originally downloaded the app via TestFlight) without issue and initialization succeeded. Can you add me as a tester on your release version in TestFlight? Please send a private message and I can provide my email.
     
  7. denischernitsyn

    denischernitsyn

    Joined:
    Apr 24, 2013
    Posts:
    15
    It was working on some previous versions. But some IDs didn't work. Now all of them don't work. The issue is the same. I'll write you a private message now
     
  8. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    What IDs are you referring to? I'm asking specifically about IAP Initialization which you say is failing. And can you elaborate "working on some previous versions". So you DID have a release build working at one point? What changed, if so, and what specific IAP version was working? Did it stop working after an IAP upgrade, for example?
     
  9. denischernitsyn

    denischernitsyn

    Joined:
    Apr 24, 2013
    Posts:
    15
    It was working on 0.14.0. 3 of 9 were not working. And I don't know the reason why. I use IAP buttons. 1 fore restore and one for each subscription productID. Nothing was modified in IAP original code but changing PurchaseProductTo public to call it from another script.
     
  10. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    3 of 9 what were not working? Sorry I'm not quite following. If you are referring to 3 of 9 products were "not working", can you elaborate? How are they not working, compared to those that do? If you see the logs that you provided, it does say that "8 products" were retrieved, for example. One note, we do have an open issue if you disable a product in iTunes Connect. Make sure all products that are defined are available for sale.
     
  11. denischernitsyn

    denischernitsyn

    Joined:
    Apr 24, 2013
    Posts:
    15
    Sorry for the miscommunication. In the project we have Leanplum A/B test integrated. We have multiple subscription screens. And 1 screen is under 1 cohort. And this screen has 3 subscription types. And none of them is working. It means that Unity IAP logs say that these Products are not available. Other products and cohorts were working as normal.

    After an update I receive the error, which is shown in the initial post.
    All of the products are available for sale. We created new products and test only them. Can it be an issue, that we had one productIDs in the beginning and then created some completely new? But the IDs in Unity and in store are identical. And Development build can subscribe normally as I wrote before
     
  12. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    You do not want to delete any products if a user has bought them. Sometimes it can take a few hours for new products to be available. In addition, when you release a new product, the app needs to be downloaded from TestFlight. Also, in this thread, we are investigating the issue of Release vs Development build not initializing at all due to the EarlyTransactionObserver exception, and is what I am currently investigating.
     
    Last edited: May 8, 2018
  13. denischernitsyn

    denischernitsyn

    Joined:
    Apr 24, 2013
    Posts:
    15
    The problem was not in IAP. It was because of all of the Analytics systems were starting too fast and couldn't be loaded normally. One of them broke others and in the end somehow broke your IAP. It was working before, because we optimized our build loading time and in the development mode it just had enough time to load everything. I made a queue order of loading all of the managers and everything seems to be working now.
     
Thread Status:
Not open for further replies.