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:
Unloading 3 unused Assets to reduce memory usage. Loaded Objects now: 11938.
Total: 11.159625 ms (FindLiveObjects: 0.520583 ms CreateObjectMapping: 0.874000 ms MarkObjects: 9.603166 ms DeleteObjects: 0.161416 ms)
2018-05-10 21:46:05.302170+0300 myapp[986:412676] UnityIAP:Received 8 products
2018-05-10 21:46:05.304651+0300 myapp[986:412676] UnityIAP:No App Receipt found
2018-05-10 21:46:05.308060+0300 myapp[986:412676] UnityIAP:No App Receipt found
2018-05-10 21:46:05.308711+0300 myapp[986:412676] UnityIAP:Add transaction observer
2018-05-10 21:46:05.308744+0300 myapp[986:412676] UnityIAP:UpdatedTransactions
2018-05-10 21:46:05.308790+0300 myapp[986:412676] UnityIAP:No App Receipt found
.... UnityIAP:No App Receipt found is copied a thousand times here.
2018-05-10 21:46:05.340451+0300 myapp[986:412676] UnityIAP:No App Receipt found
2018-05-10 21:46:05.340475+0300 myapp[986:412676] UnityIAP UnityEarlyTransactionObserver: Request to initiate queued payments
NullReferenceException: A null value was found where an object instance was required.
at Facebook.Unity.Mobile.IOS.IOSFacebook.MarshallDict (System.Collections.Generic.Dictionary`2 dict) [0x00000] in <filename unknown>:0
at Facebook.Unity.Mobile.IOS.IOSFacebook.AppEventsLogEvent (System.String logEvent, Nullable`1 valueToSum, System.Collections.Generic.Dictionary`2 parameters) [0x00000] in <filename unknown>:0
at FacebookAnalyticsSystem.SendEvent (System.String eventName, .AnalyticsParameter[] parameters) [0x00000] in <filename unknown>:0
at System.Collections.Generic.List`1[T].ForEach (System.Action`1 action) [0x00000] in <filename unknown>:0
at UnityEngine.Events.UnityEvent`2[T0,T1].Invoke (.T0 arg0, .T1 arg1) [0x00000] in <filename unknown>:0
at Monclarity.HNP.AnalyticsEventWithParameters.Raise () [0x00000] in <filename unknown>:0
at UnityEngine.Events.UnityEvent.Invoke () [0x00000] in <filename unknown>:0
at Iridescent.Core.InAppManager.PurchaseCompletedAction (UnityEngine.Purchasing.Product product) [0x00000] in <filename unknown>:0
at UnityEngine.Events.UnityEvent`1[T0].Invoke (.T0 arg0) [0x00000] in <filename unknown>:0
at UnityEngine.Purchasing.IAPButton.ProcessPurchase (UnityEngine.Purchasing.PurchaseEventArgs e) [0x00000] in <filename unknown>:0
at UnityEngine.Purchasing.IAPButton+IAPButtonStoreManager.ProcessPurchase (UnityEngine.Purchasing.PurchaseEventArgs e) [0x00000] in <filename unknown>:0
at UnityEngine.Purchasing.PurchasingManager.ProcessPurchaseIfNew (UnityEngine.Purchasing.Product product) [0x00000] in <filename unknown>:0
at UnityEngine.Purchasing.JSONStore.OnPurchaseSucceeded (System.String id, System.String receipt, System.String transactionID) [0x00000] in <filename unknown>:0
at UnityEngine.Purchasing.Extension.UnityUtil.Update () [0x00000] in <filename unknown>:0
(Filename: currently not available on il2cpp Line: -1)
Unloading 1 Unused Serialized files (Serialized files now loaded: 0)
Unloading 0 unused Assets to reduce memory usage. Loaded Objects now: 12202.
Total: 10.241416 ms (FindLiveObjects: 0.500875 ms CreateObjectMapping: 0.241458 ms MarkObjects: 9.473708 ms DeleteObjects: 0.024916 ms)
Unloading 3 Unused Serialized files (Serialized files now loaded: 0)
UnloadTime: 0.971958 ms
Unloading 1 unused Assets to reduce memory usage. Loaded Objects now: 12593.
Total: 10.263041 ms (FindLiveObjects: 0.671916 ms CreateObjectMapping: 0.248541 ms MarkObjects: 9.304000 ms DeleteObjects: 0.038041 ms)
@denischernitsyn 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?
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.
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?
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.
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.
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
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?
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.
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.
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
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.
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.