views:

821

answers:

1

After searching through this forum and online for hours, I can't find an answer to the problem I'm having. Here's the basic scenario:

Trying to make an in-app purchase in my app in the sandbox environment always fails. Getting the list of available products through SKProductsRequest works fine .. I get an array of valid SKProduct objects back. But after I queue an SKPayment in the SKPaymentQueue, the transactionState of the SKPaymentTransaction object that the observe gets is SKPaymentTransactionStateFailed. HOWEVER, when I try to see WHY it failed, I find that the error property of the SKPaymentTransaction object is nil. There is no NSError object there to query!!

Also, in the app, no pop up ever appears to ask for the account credentials to verify the purchase! And yes, I did first log out of my real Apple ID in the Settings app, and I did not try to sign back in there with my test account ID. That way, there should be a popup when I try to make a purchase asking me for my Apple ID info, where I would enter the test account info. But that popup never appears. The transaction just silently fails.

If I query the payment property of the failed SKPaymentTransaction object, I find the correct SKPayment object with the correct productIdentifier, so the failed transaction is at least asking for the right product. So why is it failing?

Has anybody else seen this?

I've gone through all of the proper setup steps listed in the documentation and elsewhere in this forum ... I created a non-wildcare app ID, activated in-app payments for that ID, created a new, dummy app in iTunes Connect (checking "upload binary later"), created some in-app purchase products, made them available for sale, created a new developer provisioning profile for the new app ID, downloaded that profile and installed it in Xcode and on my test phone, changed the bundle identifier in the info.plist of the app, changed the code signing to use the new provisioning profile, set up a test user in iTunes Connect with a novel email address, etc etc etc etc etc. Like I say, I do get an array of valid SKProduct objects from the app store servers, so things must be set up somewhat correctly. But even after redoing everything from scratch a few times and tweaking everything I can think of, I can't get a sandbox purchase to go through .. or even to get the confirm purchase popup!

Any ideas?

Some details, if they help:

•• I'm running 3.0.1 on my phone •• this is for a new app, so it's not already for sale in the app store. I'm using a dummy app in iTunes Connect for testing IAP. •• I'm on Snow Leopard with the 3.1.2 version of the iPhone SDK

Please help!

A: 

This explanation helped me a lot

http://blog.mugunthkumar.com/coding/iphone-tutorial-%E2%80%93-in-app-purchases/

Yannick