Monday, October 31, 2011

iOS and In app purchases - what's wrong with this picture?

Well, I'm in the middle of my next submitting stuff to apple struggle. For some reason, it always seems to be this titanic, time-consuming effort. What is the matter with those guys?

Anyway, here's where I'm at. I have an paid app on the app store. So, I've gotten through that hurdle. I even submitted an update to it. So, I've managed to successfully bash my way through that whole process.

I've also added in-app purchase code to my app. I've added a product in iTunes connect which can be purchased by my app. It's got the same bundle-id, everything.

The problems start of course with testing. You knew this wasn't going to be easy, didn't you?

When I run the code to test download the available product ids (I only have one), I don't get anything back from the download. Nor error messages or anything - just an empty list.

So, what could be the cause of this? I decided to look at the in-app products page, and saw this:

The first In-App Purchase for an app must be submitted for review at the same time that you submit an app version. You must do this on the Version Details page. Once your binary has been uploaded and your first In-App Purchase has been submitted for review, additional In-App Purchases can be submitted using the table below.



So, I hadn't submitted a new version yet. So, I did, and think this maybe let me do something like resbumit the app product, or save it, or something. So, at this point I've submitted both the app and the product. And the product now has a status of "wating for review". However, the app itself is showing the infomous "invalid binary" error.


So, I'll have to resolve the invalid binary error. But, what I don't know is if this affects the status of the product. The product is currently "waiting for review". Will it be waiting for review until I get a valid binary? Could the fact that I don't have the product approved be *causing* the invalid binary? Somehow, I doubt that. I hope not.

Actually, it's the same problem I had before - you just have to reselect your app distribution certificate when submitting it via organizer.

Ok, then according to this tutorial,

http://troybrant.net/blog/2010/01/in-app-purchases-a-full-walkthrough/

if you've added your product, you also have to submit an app-binary. Then cancel the app binary (you can do this in binary details, button on the upper right corner).

So, now you will basically have you app in "developer rejected" mode, and your in-app purchase in "waiting for review" status.

This is confirmed by this posting in SO:

http://stackoverflow.com/questions/6570163/invalid-product-id-in-inapp-purchase

So, my next step is to retry running the app.

Ok, wall the reason it wasn't printing "invalid product ID" is that my program wasn't checking for it. It turns out, if I run this piece of code (as suggested in the first url listed):

for (NSString *invalidProductId in response.invalidProductIdentifiers)
{
NSLog(@"Invalid product id: %@" , invalidProductId);
}

I get this output:

2011-11-01 14:42:36.274 JlptVocabularyQuiz[2751:707] IAHelper, received products results...
2011-11-01 14:42:36.282 JlptVocabularyQuiz[2751:707] Invalid product id: com.kanjisoft.JlptVocabularyQuiz.AdditionalVocab1

So, there you go. I've been getting this all along, probably, just didn't know. It's tuesday, and I originally cleared that message on Sunday night, I think. So, it's been nearly 48 hours, and still I'm getting the problem.

So, then next thing to do is go through this checklist:

Have you enabled In-App Purchases for your App ID?
Have you checked Cleared for Sale for your product?
Have you submitted (and optionally rejected) your application binary?
Does your project’s .plist Bundle ID match your App ID?
Have you generated and installed a new provisioning profile for the new App ID?
Have you configured your project to code sign using this new provisioning profile?
Are you building for iPhone OS 3.0 or above?
Are you using the full product ID when when making an SKProductRequest?
Have you waited several hours since adding your product to iTunes Connect?
Are your bank details active on iTunes Connect? (via Mark)
Have you tried deleting the app from your device and reinstalling? (via Hector, S3B, Alex O, Joe, and Alberto)
Is your device jailbroken? If so, you need to revert the jailbreak for IAP to work. (via oh my god, Roman, and xfze)

We'll tackle that in the next post.

No comments:

Post a Comment