Reputation: 3086
I am trying to test In App Purchases on my iPhone and running into a problem where the product IDs I request information for end up being returned to me as invalid product IDs in the "didRecieveResponse" method.
I have:
Everything seems to be in place, however I still get my products returned to me as invalid IDs.
This is the code I am using:
- (void)requestProductData {
SKProductRequest *request = [[SKProductsRequest alloc] initWithProductIdentifiers: [NSSet setWithObject: @"com.domain.appname.productid"]];
request.delegate = self;
[request start];
}
- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response
{
NSArray *myProducts = response.products;
NSArray *myInvalidProducts = response.invalidProductIdentifiers;
for(int i = 1; i < myInvalidProducts.count; ++i)
{
std::cout <<"invalid product id = " << [[myInvalidProducts objectAtIndex:i] UTF8String] << std::endl;
}
for(int i = 0; i < myProducts.count; ++i)
{
SKProduct * myProduct = [myProducts objectAtIndex:i];
std::cout << "Product Info:" << std::endl;
std::cout << "\tlocalizedTitle = " << [[myProduct localizedTitle] UTF8String] << std::endl;
std::cout << "\tlocalizedDescription = " << [[myProduct localizedDescription] UTF8String] << std::endl;
std::cout << "\tproductIdentifier = " << [[myProduct productIdentifier] UTF8String] << std::endl;
std::cout << "\tprice = " << [[myProduct price] doubleValue] << std::endl;
std::cout << "\tpriceLocale = " << [myProduct priceLocale] << std::endl;
}
[request autorelease];
}
All my product IDs show up in the invalid printouts and none of them show up in the "Product Info:" printouts.
Any suggestions would be greatly appreciated...
P.S. Yes, this is built as Objective-c/c++.
Upvotes: 4
Views: 12121
Reputation: 3775
iTunes Connect interface for IAP has recently been updated that can cause Invalid : < Product ID > error.
You can now add an IAP in iTunes connect without setting the price which is defaulted to USD 0 and it'll let you save that entry.
The old version of the UI would complain when you press save if you didn't edit the price field beforehand.
It is very easy to miss this field out completely and any attempt to get information using that Product ID via any iOS call would result in Invalid : < Product ID > rather than telling you it found < Product ID > priced at USD 0.
Upvotes: 0
Reputation: 116
Please Go through the steps below:
Log in to iTunes connect using your developer account (https://itunesconnect.apple.com/WebObjects/iTunesConnect.woa/wo/).
Go to the Tab - "Contracts, Tax, and Banking"
Check the Request Contracts and Contracts in Process sections.
Check out the "iOS Paid Applications" and there Contact Info , Bank Info and Tax Info are need to Set up.
When "iOS Paid Applications" cell will move to Contracts in Effect section, I will be able to use Products for in App Purchase.
Please go through the link below for more information: http://developer.apple.com/library/ios/#technotes/tn2259/_index.html
Upvotes: 3
Reputation: 995
Please note that when iPhone is jailbroken the AppSync packet breaks in-app-purchasing testing completely. AppSync is installed with Install0us as a dependency.
You don't have to restore iOS completely, just uninstall AppSync in Cydia to test in-app-purchases with success.
All tips from all forums, tutorials and comments about fixind 'invalid product' did not work for me until I removed AppSync.
Upvotes: 2
Reputation: 3328
Deleting the app on the testing iPhone and reinstalling it worked. Also I had also waited 8 hours since submitting the in-app purchase item.
Upvotes: 4
Reputation: 11
if nothing wrong in your code, sometime it has return invalid productId just because, you may need a time over 10 hour for your changing info. taking effect. Or, the productId invalid because something wrong are remained on your device, so you can try once more with delete your app and build it again. with my experience, hope it will helps.
Upvotes: 1
Reputation: 11
I've been having a similar problem with a new app (v1.0 not yet released in store) that I was trying to add in app purchases too. I set everything up, added products, etc. and my products ALWAYS came back as invalid when I did an SKProductsRequest.
I was about to give up on the entire process, when I saw a tangentially-related post on the Apple developer forums. It suggested deleting the app from the test device and and doing a fresh build+install. That did the trick.
Just to be sure, I tried it on another device that was giving me the same trouble, and it fixed it there too.
It's just a guess, but I think that if the device has a build on it that was made with a provisioning profile that was created BEFORE you add IAP, you need to remove that build and put on a fresh one using the IAP profile. (That is, simply replacing the app in place won't do the trick.)
Upvotes: 1
Reputation: 9258
I tried everything suggested in the Apple forums and here, and still couldn't get it to work. Found the solution - your app needs to be transferred by Xcode for the sandbox to be enabled.
Obvious, right? Well, if you are working with an update to an existing account, the device will still treat it as an App Store-installed app.
Delete it, then transfer it again. It should work now :)
Upvotes: 6
Reputation: 3086
OK, so after doing everything I could possibly think of and reading every forum out there, here is what worked:
Redo EVERYHING.
This is what it took to get my store working. My best guess is that the Apple back end servers get screwed up sometimes and you just need to start from scratch.
Hope this helps everyone!
Upvotes: 0