New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix crash when StoreKit returns nil original transaction #23
Fix crash when StoreKit returns nil original transaction #23
Conversation
In the future, |
On the sandbox environment, did you delete an In-App Purchase entry through App Store Connect? I saw something on the web that StoreKit cannot provide a value for |
I did not change any IAP through App Store Connect. I deleted and reinstalled the app and then tapped Restore Purchases on my paywall and it crashed on this line because |
Yeah, StoreKit has thorny edges everywhere — hence making a framework in the first place. What I’m trying to work out is if it is more semantically accurate to nil-coalesce here or catch transactions with no |
This is my preferred fix for the bug, the `??` was too implicit for my liking. I have verified that the `productIdentifier` of the restored transaction is stable and consistent.
I have tentatively edited the branch with my preferred 'fix' here. The |
Looks great to me. I agree this is a better solution. |
Thanks for bringing this PR to fruition. I incorporated this fix (and a couple of other minor changes) into the 0.11.1 release. |
While testing restore functionality with a sandbox user I ran into a crash where the app would persistently crash due to StoreKit returning
nil
fortransaction.original
. The crash repeats infinitely since the unfinished transaction stays in the queue and replays at next app launch.Nit: do we really need
original
here at all?completeRestorePurchase
only seems to need the product ID. Is it possible for the product ID to change for a transaction?