Q:

In-app purchase, how to provide consumables after purchase

I am trying to implement IAPs in one app and I'm almost there but still facing some problems. I already posted another question before of this because I found an incomplete tutorial that was missing something so I was stuck and someone already helped me out with that... but in that tutorial they were using a table while I just want to use normal buttons. Between various answers there was an answer that gave me a new way to approach this matter.. so I am giving it a try but here comes the problems I found:

I am getting a warning, the guy  told me in the answer to include each of the following protocols in my header file: 
SKProductsRequestDelegate
SKPaymentTransactionObserver
SKRequestDelegate

and I did it with this code: 
@interface BuyTest2 : UIViewController <SKProductsRequestDelegate, SKPaymentTransactionObserver, SKRequestDelegate>

but now I'm getting this warning in m file: 
Method 'paymentQueue:updatedTransactions:' in protocol not implemented

why is that? Am I missing something? (I'm sure I am...)

when I click button to buy Coins everything works fine but after the purchase has been done I don't know how to deliver the coins... I have my code to do it but I don't know where to put it... how should I do that?
if I try again to make a test purchase I get the message that I already bought that item and that I have to click on 'OK' to download it... but after that nothing happens... and I really don't have to give something to download but I just need to add some coins to a variable and then save it with NSUserDefaults...

here is the code I am using:
in file .h i got
@interface BuyTest2 : UIViewController <SKProductsRequestDelegate, SKPaymentTransactionObserver, SKRequestDelegate>

@property (nonatomic, retain) SKProduct *currentProduct;
@property(nonatomic, readonly) SKPaymentTransactionState transactionState;
@property (nonatomic, retain) SKProductsRequest *ualRequest;

and in file .m i got:
-(void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response
  {
if(response.products.count > 0)
{
    SKProduct* product;

    for(int i = 0; i<response.products.count; i++)
    {
        product = [response.products objectAtIndex:i];

        if([product.productIdentifier isEqualToString:@"com.mycompany.myapp.1"])
        {
            self.currentProduct = product;
            [self beginPaymentWithProduct:product];
        }
    }
   }
   }

   - (void)beginPaymentWithProduct:(SKProduct*)product
   {
       SKPayment *payment = [SKPayment paymentWithProduct:product];
       [[SKPaymentQueue defaultQueue] addPayment:payment];
   }

   - (BOOL)canMakePurchases
   {
       return [SKPaymentQueue canMakePayments];
   }

   - (IBAction)buyCoins:(id)sender
   {
       if([self canMakePurchases])
       {
           ualRequest = [[SKProductsRequest alloc] initWithProductIdentifiers:[NSSet        setWithArray:[NSArray arrayWithObjects: @"com.mycompany.myapp.1", nil]]];
           [ualRequest setDelegate:self];
           [ualRequest start];
       }
   }

   - (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions
   {
       for (SKPaymentTransaction* transaction in transactions) {
           if (transaction.transactionState == SKPaymentTransactionStatePurchased) {
               NSLog(@"Transaction Purchased: %@", transaction);
               // Make purchase available to the user, etc...
               // Once that's all done...
               [queue finishTransaction:transaction];
           }
           else if (transaction.transactionState == SKPaymentTransactionStateFailed) {
               NSLog(@"Transaction Failed: %@", transaction);
               // Display error to the user, using the error text in the transaction
               // This example uses NSLog, typically you'd use UIAlertView here
               NSLog(@"Error: %@", [transaction.error localizedDescription]);
           }
       }

}
Thanks for any help...

A:

but now I'm getting this warning in m file:
Method 'paymentQueue:updatedTransactions:' in protocol not implemented

The error message is very informative here. paymentQueue:updatedTransactions: is part of the SKPaymentTransactionObserver protocol, and is a required method (meaning, you have to implement it if you are to become an observer of payment transactions. Remember, warnings are something you should take a serious look at, and typically you should consider them as errors). The documentation for this protocol can be found here.
The discussion for this particular method is fairly clear on it's purpose, and what you are required to do. It is the means to check whether a transaction has gone though, and if it has it is your responsibility to provide the functionality/content to the user.

The application should process each transaction by examining the transaction’s transactionState property. If transactionState is SKPaymentTransactionStatePurchased, payment was successfully received for the desired functionality. The application should make the functionality available to the user. If transactionState is SKPaymentTransactionStateFailed, the application can read the transaction’s error property to return a meaningful error to the user.
Once a transaction is processed, it should be removed from the payment queue by calling the payment queue’s finishTransaction: method, passing the transaction as a parameter.

The best documentation on how to use the IAP system is available from Apple, and I strongly recommend you give it a good read. It is available here.
Update:
Here is a code snippet showing the general gist of what's required in this method:
- (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions
{
    for (SKPaymentTransaction* transaction in transactions) {
        if (transaction.transationState == SKPaymentTransactionStatePurchased) {
            NSLog(@"Transaction Purchased: %@", transaction);
            // Make purchase available to the user, etc...
            // Once that's all done...
            [queue finishTransaction:transaction];
        }
        else if (transaction.transactionState == SKPaymentTransactionStateFailed) {
            NSLog(@"Transaction Failed: %@", transaction);
            // Display error to the user, using the error text in the transaction
            // This example uses NSLog, typically you'd use UIAlertView here
            NSLog(@"Error: %@", [transaction.error localizedDescription]);
        }
    }
}

And remember to register yourself for events. You can do this via:
[[SKPaymentQueue defaultQueue] addTransactionObserver:self];
[[SKPaymentQueue defaultQueue] removeTransactionObserver:self];

Add these in the appropriate places, such as init/dealloc. Do refrain from using this in viewDidLoad, as this is more of a visual thing, and not a data model concern.

