I’m trying to convert an existing iOS game to be subscription-based, and so I need to check the original app version to see if the customer purchased the old version, as required by Apple’s developer terms. I’m using code based on the final example from this page of the Unity manual.
(I’ll note that none of the Unity classes used here are documented in the Unity scripting API–is there a difference place I should be looking for info?)
ConfigurationBuilder builder = ConfigurationBuilder.Instance(StandardPurchasingModule.Instance());
IAppleConfiguration appleConfig = builder.Configure<IAppleConfiguration>();
string receiptText = appleConfig.appReceipt;
At this point, when I test my app on test device #1 in TestFlight, receiptText is an empty string. (There’s more code after this point to validate the receipt and examine its contents, but obviously none of it works with an empty input.)
Restoring purchases does not change the result.
Test device #2 does NOT get an empty string, and on that second device the receipt validates and parses successfully. (Though I’m suspicious it’s a fake sandbox receipt rather than real one–still investigating.) So I’m reasonably sure the code is basically correct.
One possible reason for the difference is that device #1 bought the game, whereas I’m moderately sure device #2 did not. (That was the point–to test both behaviors. Currently, neither is working as expected.)
Why might I get an empty string here? What should I do about it?