PeterStaev / nativescript-purchase

:moneybag: A NativeScript plugin for making in-app purchases!
Apache License 2.0
83 stars 28 forks source link

nativeValue.payment is null in transaction.ios.ts #72

Closed RickyLarsen closed 5 years ago

RickyLarsen commented 5 years ago

Something changed on the iOS side of things recently, not sure what. But nativeValue.payment is null sometimes. This is similar to issue #58 where having a TestFlight build seems to have something to do with it. We added a null check around nativeValue.payment and it solves the problem.

RickyLarsen commented 5 years ago

This is only part of the issue. One device in our office shows nativeValue itself coming through as null at some point. It works if I add a null check if (nativeValue) around the entire function. It seems difficult to replicate this bug since it appears on some devices and doesn't on most and it is likely only a sandbox issue.

PeterStaev commented 5 years ago

Hey @RickyLarsen , make sure you are using the latest version of the plugin. In one of the last updates, I've added this: https://github.com/PeterStaev/nativescript-purchase/blob/5ff2667122a8552375eb6c5439eae07c0cb34623/purchase.ios.ts#L130-L133

So I do not see a way for the whole nativeValue to become null in the transaction file. I will merge now the PR that checks for null on the payment.

RickyLarsen commented 5 years ago

@PeterStaev This is a path that actually doesn't get caught by that if statement. https://github.com/PeterStaev/nativescript-purchase/blob/eddb8dea28f332d1717cb351d02f04256be7420a/transaction/transaction.ios.ts#L43-L46

PeterStaev commented 5 years ago

Good catch, @RickyLarsen ! I've pushed a new version (2.0.12) on npm that should have this path covered. Thanks!