In app purchase crashing app on startup solved

Hello, I’m using unity 2020.3.18 and in app purchase v 3.23. Ive updated to 4.1 to see if that would fix it. Unfortunately, it didn’t. My app works fine until I purchase something and close the app. Once I restart it, it crashes on startup. The error only shows up on the device not the editor. The only plugins I’m using is app tracking transparency for unity -iOS 14 IDFA and Nice vibrations. Heres the log from Xcode.

2021-10-15 20:17:16.406909-0500 ZombieCrateChallenge[400:14341] [connection] nw_endpoint_handler_set_adaptive_read_handler [C3.1 35.241.52.229:443 ready channel-flow (satisfied (Path is satisfied), viable, interface: en0, ipv4, dns)] unregister notification for read_timeout failed
2021-10-15 20:17:16.407960-0500 ZombieCrateChallenge[400:14341] [connection] nw_endpoint_handler_set_adaptive_write_handler [C3.1 35.241.52.229:443 ready channel-flow (satisfied (Path is satisfied), viable, interface: en0, ipv4, dns)] unregister notification for write_timeout failed
OnInitialized: PASS
IAPManager: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()

Uploading Crash Report
NullReferenceException: Object reference not set to an instance of an object.
  at IAPManager.ProcessPurchase (UnityEngine.Purchasing.PurchaseEventArgs args) [0x00000] in <00000000000000000000000000000000>:0
  at UnityEngine.Purchasing.PurchasingManager.ProcessPurchaseIfNew (UnityEngine.Purchasing.Product product) [0x00000] in <00000000000000000000000000000000>:0
  at UnityEngine.Purchasing.PurchasingManager.ProcessPurchaseOnStart () [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 System.Action.Invoke () [0x00000] in <00000000000000000000000000000000>:0
  at UnityEngine.Purchasing.Extension.UnityUtil.Update () [0x00000] in <00000000000000000000000000000000>:0

Uploading Crash Report
NullReferenceException: Object reference not set to an instance of an object.
  at IAPManager.ProcessPurchase (UnityEngine.Purchasing.PurchaseEventArgs args) [0x00000] in <00000000000000000000000000000000>:0
  at UnityEngine.Purchasing.PurchasingManager.ProcessPurchaseIfNew (UnityEngine.Purchasing.Product product) [0x00000] in <00000000000000000000000000000000>:0
  at UnityEngine.Purchasing.PurchasingManager.ProcessPurchaseOnStart () [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 System.Action.Invoke () [0x00000] in <00000000000000000000000000000000>:0
  at UnityEngine.Purchasing.Extension.UnityUtil.Update () [0x00000] in <00000000000000000000000000000000>:0
UnityEngine.UnhandledExceptionHandler:PrintException(String, Exception)
UnityEngine.UnhandledExceptionHandler:HandleUnhandledException(Object, UnhandledExceptionEventArgs)
System.UnhandledExceptionEventHandler:Invoke(Object, UnhandledExceptionEventArgs)

You have a null reference exception in your game, you’ll need to debug to determine where it is. Since you can reproduce, you can debug in XCode and your Debug.Log statements will display https://discussions.unity.com/t/700551

1 Like