Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

EXC_BAD_ACCESS during in app purchase test

Tags:

Running a test for my in app purchase (first time doing in app purchases). I get EXC_BAD_ACCESS on the third line of this code:

    SKPayment *payment = [SKPayment paymentWithProduct:electronicProd];     [[SKPaymentQueue defaultQueue] addTransactionObserver:self];     [[SKPaymentQueue defaultQueue] addPayment:payment]; 

The is under an IBAction for a button. electronicPack is declared in the header as a SKProduct. Threw some NSLogs in the productsRequest didReceiveResponse, and when the product was requested (in the viewDidLoad) and they showed it was correctly fetching the product and storing it in electronicPack. Defined electronicPack as [[request.products] objectAtIndex:0] in the didReceiveResponse page. So yea. Thats where im at, dont know what to do. Any help is appreciated.

UPDATE: FIXED accidentally left in code that was adding an extra transaction observer lol

like image 668
Barry Nailor Avatar asked Aug 22 '11 11:08

Barry Nailor


1 Answers

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.

like image 99
Mr. T Avatar answered Sep 19 '22 22:09

Mr. T