IAP callbacks not working at all for iOS builds.

Hi,

We are using Unity IAP, and while it works flawlessly on Android, it is showing some weird issues on iOS.
On iOS, buying any of the packages prompts the iOS purchase panel, and I can purchase it and it shows Purchase Success popup too.

But, after tapping on it, the Unity application does not log any PurchaseComplete or PurchaseFailed callbacks - so we cannot process the logic to handle IAP further.

This is only happening on iOS.

I’ve gone through the forums and the net, and nothing seems to be of help. We have properly set up appstore connect, sandbox testers and all - but this issue still persists.
We also tried using the latest IAP package (4.10.0), and updating the IStoreListener to IDetailedStoreListener, but that didn’t help either. So we downgraded to older implementation.

Version Details:

Unity - 2021.3.30f1
IAP - 4.9.4
XCode - 14.1
iOS - 16.1

I have also attached is a minimal project for iOS in which you can see the code for this.

Also, the log for the build:

2023-11-20 13:35:01.235233+0530 IAPSample[3002:1674053] UnityIAP UnityEarlyTransactionObserver: Created
2023-11-20 13:35:01.236013+0530 IAPSample[3002:1674053] UnityIAP UnityEarlyTransactionObserver: Registered for lifecycle events
2023-11-20 13:35:01.280901+0530 IAPSample[3002:1674053] Built from '2021.3/staging' branch, Version '2021.3.30f1 (b4360d7cdac4)', Build type 'Release', Scripting Backend 'il2cpp'
2023-11-20 13:35:01.281450+0530 IAPSample[3002:1674053] MemoryManager: Using 'Default' Allocator.
[UnityMemory] Configuration Parameters - Can be set up in boot.config
    "memorysetup-bucket-allocator-granularity=16"
    "memorysetup-bucket-allocator-bucket-count=8"
    "memorysetup-bucket-allocator-block-size=4194304"
    "memorysetup-bucket-allocator-block-count=1"
    "memorysetup-main-allocator-block-size=16777216"
    "memorysetup-thread-allocator-block-size=16777216"
    "memorysetup-gfx-main-allocator-block-size=16777216"
    "memorysetup-gfx-thread-allocator-block-size=16777216"
    "memorysetup-cache-allocator-block-size=4194304"
    "memorysetup-typetree-allocator-block-size=2097152"
    "memorysetup-profiler-bucket-allocator-granularity=16"
    "memorysetup-profiler-bucket-allocator-bucket-count=8"
    "memorysetup-profiler-bucket-allocator-block-size=4194304"
    "memorysetup-profiler-bucket-allocator-block-count=1"
    "memorysetup-profiler-allocator-block-size=16777216"
    "memorysetup-profiler-editor-allocator-block-size=1048576"
    "memorysetup-temp-allocator-size-main=4194304"
    "memorysetup-job-temp-allocator-block-size=2097152"
    "memorysetup-job-temp-allocator-block-size-background=1048576"
    "memorysetup-job-temp-allocator-reduction-small-platforms=262144"
    "memorysetup-temp-allocator-size-background-worker=32768"
    "memorysetup-temp-allocator-size-job-worker=262144"
    "memorysetup-temp-allocator-size-preload-manager=262144"
    "memorysetup-temp-allocator-size-nav-mesh-worker=65536"
    "memorysetup-temp-allocator-size-audio-worker=65536"
    "memorysetup-temp-allocator-size-cloud-worker=32768"
    "memorysetup-temp-allocator-size-gfx=262144"
-> applicationDidFinishLaunching()
2023-11-20 13:35:01.376072+0530 IAPSample[3002:1674053] UnityIAP UnityEarlyTransactionObserver: Added to the payment queue
2023-11-20 13:35:01.377348+0530 IAPSample[3002:1674053] Unbalanced calls to begin/end appearance transitions for <UnityDefaultViewController: 0x12921ab40>.
-> applicationDidBecomeActive()
GfxDevice: creating device client; threaded=1; jobified=0
Initializing Metal device caps: Apple A15 GPU
Initialize engine version: 2021.3.30f1 (b4360d7cdac4)
UnloadTime: 0.872791 ms
Product id : in.dring.headsup_famoussportspersonalities
Dring.Games.IAP.IAPManager:Start()

Product id : in.dring.tuidg
Dring.Games.IAP.IAPManager:Start()

Product id : in.dring.dialoguebaazi
Dring.Games.IAP.IAPManager:Start()

Unity IAP: <b>Unity In-App Purchasing</b> requires <b>Unity Gaming Services</b> to have been initialized before use.
- Find out how to initialize <b>Unity Gaming Services</b> by following the documentation <i>https://docs.unity.com/ugs-overview/services-core-api.html#InitializationExample</i>
or download the <i>06 Initialize Gaming Services</i> sample from <i>Package Manager > In-App Purchasing > Samples</i>.
- If you are using the codeless API, you may want to enable the enable <b>Unity Gaming Services</b> automatic initialization by checking the <b>Automatically initialize Unity Gaming Services</b> checkbox at the bottom of the <b>IAP Catalog</b> window
UnityEngine.Purchasing.UnityPurchasing:Initialize(IStoreListener, ConfigurationBuilder, ILogger, String, IAnalyticsAdapter, IAnalyticsAdapter, ICatalogProvider, IUnityServicesInitializationChecker)
UnityEngine.Purchasing.UnityPurchasing:Initialize(IStoreListener, ConfigurationBuilder)

2023-11-20 13:35:03.991023+0530 IAPSample[3002:1674053] UnityIAP: Requesting 3 products
2023-11-20 13:35:04.009558+0530 IAPSample[3002:1674053] UnityIAP: Requesting product data...
2023-11-20 13:35:04.039214+0530 IAPSample[3002:1674074] UnityIAP: Received 3 products
UnityStoreListener/OnInitialized
Dring.Games.IAP.UnityStoreListener:OnInitialized(IStoreController, IExtensionProvider)
UnityEngine.Purchasing.PurchasingManager:OnProductsRetrieved(List`1)
UnityEngine.Purchasing.AppleStoreImpl:OnProductsRetrieved(String)
UnityEngine.Purchasing.Extension.UnityUtil:Update()

Sucessfull intialization of IAP
Dring.Games.IAP.IAPManager:OnInitisationComplete(Boolean)
UnityEngine.Purchasing.PurchasingManager:OnProductsRetrieved(List`1)
UnityEngine.Purchasing.AppleStoreImpl:OnProductsRetrieved(String)
UnityEngine.Purchasing.Extension.UnityUtil:Update()

InvalidOperationException: Collection was modified; enumeration operation may not execute.
  at System.Collections.Generic.Dictionary`2+Enumerator[TKey,TValue].MoveNext () [0x00000] in <00000000000000000000000000000000>:0
  at Dring.Games.IAP.IAPManager.OnInitisationComplete (System.Boolean isInitialised) [0x00000] in <00000000000000000000000000000000>:0
  at UnityEngine.Purchasing.PurchasingManager.OnProductsRetrieved (System.Collections.Generic.List`1[T] products) [0x00000] in <00000000000000000000000000000000>:0
  at UnityEngine.Purchasing.AppleStoreImpl.OnProductsRetrieved (System.String json) [0x00000] in <00000000000000000000000000000000>:0
  at UnityEngine.Purchasing.Extension.UnityUtil.Update () [0x00000] in <00000000000000000000000000000000>:0

[TestIAPView/BuyIAPItem3]
TestIAPView:BuyIAPItem3()
UnityEngine.Events.UnityEvent:Invoke()
UnityEngine.EventSystems.ExecuteEvents:Execute(GameObject, BaseEventData, EventFunction`1)
UnityEngine.EventSystems.StandaloneInputModule:ProcessTouchPress(PointerEventData, Boolean, Boolean)
UnityEngine.EventSystems.StandaloneInputModule:ProcessTouchEvents()
UnityEngine.EventSystems.StandaloneInputModule:Process()

[IAPManager/InitiatePurchaseWithId]Product Purchase Init!
Dring.Games.IAP.IAPManager:InitiatePurchaseWithId(String)
UnityEngine.Events.UnityEvent:Invoke()
UnityEngine.EventSystems.ExecuteEvents:Execute(GameObject, BaseEventData, EventFunction`1)
UnityEngine.EventSystems.StandaloneInputModule:ProcessTouchPress(PointerEventData, Boolean, Boolean)
UnityEngine.EventSystems.StandaloneInputModule:ProcessTouchEvents()
UnityEngine.EventSystems.StandaloneInputModule:Process()

[IAPManager/InitiatePurchaseWithId]Product Purchase Init sucess!
Dring.Games.IAP.IAPManager:InitiatePurchaseWithId(String)
UnityEngine.Events.UnityEvent:Invoke()
UnityEngine.EventSystems.ExecuteEvents:Execute(GameObject, BaseEventData, EventFunction`1)
UnityEngine.EventSystems.StandaloneInputModule:ProcessTouchPress(PointerEventData, Boolean, Boolean)
UnityEngine.EventSystems.StandaloneInputModule:ProcessTouchEvents()
UnityEngine.EventSystems.StandaloneInputModule:Process()

Unity IAP: <b>Unity In-App Purchasing</b> requires <b>Unity Gaming Services</b> to have been initialized before use.
- Find out how to initialize <b>Unity Gaming Services</b> by following the documentation <i>https://docs.unity.com/ugs-overview/services-core-api.html#InitializationExample</i>
or download the <i>06 Initialize Gaming Services</i> sample from <i>Package Manager > In-App Purchasing > Samples</i>.
- If you are using the codeless API, you may want to enable the enable <b>Unity Gaming Services</b> automatic initialization by checking the <b>Automatically initialize Unity Gaming Services</b> checkbox at the bottom of the <b>IAP Catalog</b> window
UnityEngine.Purchasing.PurchasingManager:InitiatePurchase(Product, String)
UnityEngine.Events.UnityEvent:Invoke()
UnityEngine.EventSystems.ExecuteEvents:Execute(GameObject, BaseEventData, EventFunction`1)
UnityEngine.EventSystems.StandaloneInputModule:ProcessTouchPress(PointerEventData, Boolean, Boolean)
UnityEngine.EventSystems.StandaloneInputModule:ProcessTouchEvents()
UnityEngine.EventSystems.StandaloneInputModule:Process()

2023-11-20 13:35:20.560659+0530 IAPSample[3002:1674053] UnityIAP: PurchaseProduct: in.dring.dialoguebaazi
-> applicationWillResignActive()
-> applicationDidBecomeActive()
-> applicationWillResignActive()
-> applicationDidBecomeActive()

This seems like such a random issue, and we are dumbfounded that Android build works perfect and its iOS that has this issue.

9482260–1333570–IAP Sample.zip (1.4 MB)

Bump

I’m having the same issue. Did you fix it? I’m trying to purchase a subscription product. None of the callbacks are called. The only logs I receive from the backend are these:

UnityIAP: PurchaseProduct: main_subscription0

UnityIAP: UpdatedTransactions

main_subscription0 is the id of the product.