jamesmontemagno / InAppBillingPlugin

Cross-platform In App Billing Plugin for .NET
MIT License
651 stars 152 forks source link

Move AddTransactionObserver to Finished Loading. Add RemoveTransactionObserver to WillTerminate #40

Closed ExperimentsAndIdeas closed 7 years ago

ExperimentsAndIdeas commented 7 years ago

Finally, to prevent delays when processing an IAP, make sure to add it to finish launching.

I've read all the docs regarding the TransactionObserver, and it's necessary to remove the observer to prevent the app from crashing.

One case is when a purchase occurs in the App Store (using a coupon), or a parental approval, or when the network connectivity is resumed.

To prevent this, call SKPaymentQueue.DefaultQueue.RemoveTransactionObserver(paymentObserver);

All of this is mentioned in Apple Tech Note 2387, along with justifications.

Bartmax commented 7 years ago

So how this should be used on the client app? Where/when one should dispose the InAppBilling ?

jamesmontemagno commented 7 years ago

In a finally after connecting.

Not required though from my testing.

Bartmax commented 7 years ago

I find nowhere where removing the TransactionObserver is mentioned/suggested on Apple Tech Note 2387 I may be missing something.

In a finally after connecting.

If I'm not wrong that would prevent out-of-band transactions. Doesn't make any sense.

maybe @makerofthings7 can provide docs or insights ?