Woltus
April 19, 2021, 1:09pm
1
I had a working purchaser. After I added receipt validation purchases are restored automatically on iOS.
It looks like after initialization there is ProcessPurchase called 26 times for every bought product.
Unity 2019.4.17
IAP 2.1.1
Platform: iOS
7054888–837397–Purchaser.cs (6.27 KB)
7054888–837400–log.txt (216 KB)
@Woltus You only have one product? You mention 26. Before reading through your log, is your iOS restore method being called? Can you upgrade to IAP 3.0.2 and test? Can you filter your log to include only your Debug.Log statements and any IAP system logs and errors.
Woltus
April 19, 2021, 7:09pm
3
I have 6 products. After Initialization ProcessPurchase is called 26 times for each of them.
Restore Purchases method was NOT called.
7056301–837829–log_filtered.txt (172 KB)
Please share the code that you are actually using. The code you shared only has a single product more.larvas_removeads
Woltus
April 19, 2021, 7:21pm
5
Please add Debug.Log statements in ALL of your purchase methods in all 3 scripts. There is something in your code that is causing this behavior. ProcessPurchase should never be triggered during IAP initialization unless you are actually purchasing a product at that time, or you are returning Pending from ProcessPurchase (but you are not). Where are you seeing the 26 times, how are you logging ProcessPurchase?
Woltus
April 20, 2021, 10:52am
7
JeffDUnity3D:
Please add Debug.Log statements in ALL of your purchase methods in all 3 scripts. There is something in your code that is causing this behavior. ProcessPurchase should never be triggered during IAP initialization unless you are actually purchasing a product at that time, or you are returning Pending from ProcessPurchase (but you are not). Where are you seeing the 26 times, how are you logging ProcessPurchase?
I attached new logs and scripts with additional Debug.Log statements. I updated IAP and I still have this issue.
From logs:
Purchaser - OnInitialized: PASS
IAPs.Purchaser:OnInitialized(IStoreController, IExtensionProvider)
UnityEngine.Purchasing.PurchasingManager:CheckForInitialization()
UnityEngine.Purchasing.PurchasingManager:OnProductsRetrieved(List`1)
UnityEngine.Purchasing.AppleStoreImpl:OnProductsRetrieved(String)
System.Action:Invoke()
UnityEngine.Purchasing.Extension.UnityUtil:Update()
...
Purchaser - Process purchase com.car.mechanic_noads
IAPs.Purchaser:ProcessPurchase(PurchaseEventArgs)
UnityEngine.Purchasing.PurchasingManager:ProcessPurchaseIfNew(Product)
UnityEngine.Purchasing.PurchasingManager:OnProductsRetrieved(List`1)
UnityEngine.Purchasing.AppleStoreImpl:OnProductsRetrieved(String)
System.Action:Invoke()
UnityEngine.Purchasing.Extension.UnityUtil:Update()```
It looks like ProcessPurchase method is called by OnProductsRetieved event just like OnInitialized method.
[7058305--838171--Purchaser.cs|attachment](upload://4tixKbwGf7He5X8B0yhJCVfaUKw.cs) (6.98 KB)
[7058305--838174--NoAds.cs|attachment](upload://cnGD8IWRwvVuaWQZ6OCzpHElNZV.cs) (830 Bytes)
[7058305--838177--PremiumCar.cs|attachment](upload://bpvcSQy6C9tV7znv5LVm7mGWhHf.cs) (1.14 KB)
[7058305--838180--log_filtered_20_04.txt|attachment](upload://gqzylYSVhSpttmhxHRZ6y2YE2LZ.txt) (145 KB)
@Woltus Sorry I would not be able to debug your code. Please compare to the Sample IAP project here Sample IAP Project