IAP takes money but does not run the .purchased code

The IAP is to remove advertisments in the game. When the remove ads button is pressed the app succefully calls the right IAP and completes the request, moeny is taken from the users account however the code required to remove the adverts does not run. I cant work out where i should put the code in order for it to run after purchase completion.

Replies

You place the code in there:


-(void) paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions{
    for(SKPaymentTransaction *transaction in transactions){
        switch (transaction.transactionState){
            case SKPaymentTransactionStatePurchasing:
                break;
            case SKPaymentTransactionStatePurchased:

               //place fulfillment code here