EXC_BAD_ACCESS during in app purchase test EXC_BAD_ACCESS during in app purchase test objective-c objective-c

EXC_BAD_ACCESS during in app purchase test


I've had the same issue, my solution was to call

[[SKPaymentQueue defaultQueue] removeTransactionObserver:self];

on leaving the In-App Store in my App.Maybe it will help someone in the future.


Seems like the issue is from trying to add a transaction observer before removing the previous one. Add the following to your controller to fix this issue:

- (void)viewDidDisappear:(BOOL)animated{    [super viewDidDisappear:animated];    [[SKPaymentQueue defaultQueue] removeTransactionObserver:self];}

Hope this helps!


Mr.T answer is the best solution!

In swift I call this removeTransactionObserver here:

deinit {    SKPaymentQueue.defaultQueue().removeTransactionObserver(self)}