Search code examples
iosios5in-app-purchase

In App Purchase Crash - [[SKPaymentQueue defaultQueue] addPayment:payment];


I am getting a crash with the following error message:

[FilterPurchase respondsToSelector:]: message sent to deallocated instance 0x1edacba0

This occurs on this line:

 [[SKPaymentQueue defaultQueue] addPayment:payment];

The problem occurs when I load the In App Purchase View, then remove the view from superview and then re-open it and click to make a purchase.

Has anyone got any ideas on how I could correct this issue. Don't know if the above is enough information to correct the issue.

Don't know if this has anything to do with it but it is called on each load.

[[SKPaymentQueue defaultQueue] addTransactionObserver:self];

Thanks


Solution

  • The problem I think is fixed. Just before the back button to close the modal is pressed I call.

     [[SKPaymentQueue defaultQueue] removeTransactionObserver:self];