Reputation: 70997
I have created a test account for sandbox testing of in-app purchases. I am following these steps to test
Start process to download a product
SKPayment *payment = [SKPayment paymentWithProductIdentifier:productId];
[[SKPaymentQueue defaultQueue] addPayment: payment];
Now ideally I should be asked for the user name/pwd at this point. But I am not prompted for anything and the transaction fails (obviously because I am not logged in)
If I try to login from Settings->Store, it asks for my credit info which I'm sure is not necessary.
Can someone please help me with this issue.
Thanks...
Upvotes: 1
Views: 6705
Reputation: 70997
Ok. This was stupid! But hope someone can learn from my mistakes :) I was testing the in-app purchase with a adhoc distribution profile. And acc to Apple engineers, as soon as you do that, the test account "stops" being a test account.
In-app purchases CAN ONLY BE TESTED by launching your app via XCode in debug mode!
Update
This is not true any more. It supposedly works fine with adhoc builds as well now.
Source: recent testing of in-app purchases using an adhoc build.
Upvotes: 3
Reputation: 3719
I ran into the same problem. As suggested by Oleg, the issue was that the productID was invalid. Set a break point at
- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response and check response.products.
You may find that the productID is not in response.products. When this happen, the transaction will proceed as purchase cancel by user, therefore, never prompt for login.
Upvotes: 0
Reputation: 3421
Make sure that you have in-app purchases turned on in your provisioning file
Upvotes: 1
Reputation: 486
Also, when sending {"receipt-data":...} to verification server do encode the receipt with Base64 before inserting it into json object. This is not mentioned in official docs anywhere: only on a couple of blogs.
Upvotes: 0