I had a similar situation and dumped the iPhone's network traffic to see what's going on. I found that the normal store was contacted instead of the sandbox. It helped to delete the app from the device, make clean and build/install it again. Apparently something with the development profile had gone wrong.
Update: To dump the network traffic of a non-jailbroken iPhone, just use Internet Sharing on your Mac and configure your iPhone to use your Mac's WiFi. Then tcpdump -n -i en1
on your Mac will do the trick.
Update: Check out this post and add your complaint so apple will get a move on fixing this issue.
iPhone storekit sandbox stopped working
Close to the same thing here - Using iPad
I had my inApp purchase working. It was fine, did everything it was supposed to. Then I started getting the Error Domain=SKErrorDomain Code=2 UserInfo=(someHexMemoryAddress) "Cannot connect to iTunes Store"
Read on one post to reset all content and settings -- Did that and didn't work.
Tried creating a new Test User in iTunes -- Didn't work.
Made sure my Code Signing Identity in the Project Build Settings was set to the correct Profile that was created with all the inApp stuff. It actually wasn't, and was somehow set to any compatible Profile. I changed it to the correct profile. This didn't work either though.
Still having the same problem.
Between the time it was working and then not working, the only thing I really did was implement Facebook Connect. One interesting thing there is the delegate method -
- (void)request:(FBRequest*)request didFailWithError:(NSError*)error;
which also gets called as a delegate method to SKRequestDelegate. I don't think this is causing a conflict because it is only getting called when there is an error.
I am still able to contact the store and get a list of available products. When I send a purchase request I get a response telling me- You've already purchased this In App purchase but it hasn't been downloaded. I click ok and then I get the Error Domain=bla bla bla .
Interestingly, I did get the dialog about previous purchase even when purchasing the item for the first time with the new test user I created.
Another thing I learned is this, IF you made the Test User, and then Signed In in the Settings App, and it asked you for a credit card, it wont work.
You need to -
1. create a new Test User,
2. sign out of all accounts in the Store settings.
3. Then go make make a purchase IN your app and it will ask you to log in with existing user.
4. Log in with the new Test User you created and it will work.
Best Answer
I was getting
SKPaymentTransactionStateFailed
error code 0 "Cannot connect to iTunes Store" and thanks to thomax for this answer my problem is solved. Turns out you MUST enter a build number under Targets->Summary.I spent the last 24 hours resetting my phone, screwing with iTunes connect, and doing just about everything i could think of before i stumbled upon this solution.