views:

56

answers:

2

I am getting down to the last programming on my little app and I am using the standard StoreKit code as follows:

- (void) paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions {
for (SKPaymentTransaction *transaction in transactions)
{   
    switch ( transaction.transactionState ) 
    {
       case SKPaymentTransactionStatePurchased: 
           [ self completeTransaction: transaction ];               
        break;
       case SKPaymentTransactionStateFailed:   
           [ self failedTransaction: transaction ];
            break;
       case SKPaymentTransactionStateRestored:  
          [ self restoreTransaction: transaction ];
            break;
       default:                 
            break;
       }    
    }
}

I am getting a MyStoreObserver may not respond to completeTransaction, failedTransaction or restoreTransaction. BTW, I have set up the MyStoreObserver as both h and m files.

The program works fine and StoreKit works fine. I am just trying to figure out what may be causing this warning so I can something to my code to make it go away.

Any ideas?

+1  A: 

Declare those methods in your .h file, or in a private category in your .m file, so that the compiler knows about them. Or move them up in your .m file so that they appear before calling them.

Eiko
Or in a class continuation (effectively a category with no name), so the compiler actually checks that they're implemented.
tc.
A: 

Thank you Vlad and Eiko...

For the newbies, here is my code that got rid of the warning in my MyStoreObserver h file..

@interface MyStoreObserver : NSObject

{
}

  • (void) completeTransaction:(SKPaymentTransaction *)transaction;
  • (void) failedTransaction: (SKPaymentTransaction *)transaction;
  • (void) restoreTransaction: (SKPaymentTransaction *)transaction;

Also, this code is used with the code contained in "In App Purchase Programming Guide".

MadProfit