iOS In App Purchase Programming Troubleshooting Guide (continuously updating)

After struggling with the error messages of in app purchasing, I finally sorted out the problem and have to app uploaded to App store. So I hope the following notes I have written may help you if you also find adding in app purchase for your app a painful process.

General Troubleshooting

  • Make sure you created a development provisioning profile for the app and selected it in project settings.
  • Use the Product > Clean to clean up the mess
  • Make sure the date and time of the device is correct
  • Make sure you send a [[SKPaymentQueue defaultQueue] finishTransaction:transaction]; at the end of (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions for cases SKPaymentTransactionStatePurchased, SKPaymentTransactionStateRestored, SKPaymentTransactionStateFailed. Otherwise the transaction is never completed (especially the “SKPaymentTransactionStateFailed”). The method (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions will get called over and over again.

“Cannot connect to iTunes Store”

  • If you get “Code=0″ errors, make sure your iTunes test account is valid and has not attempted accessing the real app store. Test accounts become invalid if accessed the real app store. You will need to create a new test account to continue testing.
  • Make sure you send the right product ID for purchasing

There is also a very good walk-through guide for your reference: http://troybrant.net/blog/2010/01/in-app-purchases-a-full-walkthrough/

About the Author