App rejected for IPv6 network problem using Unity IAP service on Unity 5.4 iOS

As the question says - I’m using Unity 5.4 and the inbuilt IAP service for iOS … but the binary has been rejected by iTunesConnect citing failure to work on an IPv6 network…
From the other questions i’ve seen it seems to suggest that this was fixed by unity on 5.3.4 …
so… confused as to why i’m getting this now.
Anybody got any clues?
Thanks

I just had my app rejected from the App Store for the same reason. I am using the latest Unity x5.5.1. I doubt it has anything to do with IPv6 specifically since Apple told me they didn’t even try to test it on IPv4. Rather I think it’s just a glitch with Unity’s Purchasing agent that can happen to anyone at any time.

If you borrowed the sample Purchaser script from the Unity tutorial like I did, you will notice that there is no provision for an initialization failure. If OnInitializedFailed() is called, all it does is print a Debug.Log statement. Then that’s it. The store is dead if you try to access it.

Instead of inadvertently giving up like that, I had the OnInitializedFailed() method call InitializePurchasing() again a few more times. Specifically I setup a watchdog counter and incremented:

public void OnInitializeFailed(InitializationFailureReason error)
    {
        // Purchasing set-up has not succeeded. Check error for reason. Consider sharing this reason with the user.
		if (initFailWatchdog++ < 100) InitializePurchasing();
		else Debug.Log("Tried 100 times to initialize IAP store without success.");
    }

I don’t know if 100 is the right number, maybe 10 would work. Maybe you could try every second forever instead of a fixed amount of times.

There’s more to be done to make this solution robust (for example: what happens if there’s no network connection, or the user turns on his network after all those initialization attempts), but it got me past the App Store approval.

@Triggly_Glix,

This is also being discussed on this forum thread, which might be helpful: http://forum.unity3d.com/threads/ios-submission-failed-due-to-purchase-failed-on-ipv6-only-wifi.428044/#post-2767624