Thursday, September 19, 2013

iOS IAP Obtaining Multiple Products Info

I have been doing some coding and researching the iOS In App Purchasing. I set up my code to loop through all the product IDs I had set up in the Manage app section of iTunes Connect. I wasn't certain however if this was the way to make it work. Seemed a little silly to ask for product information multiple times, yet I was ok with it. that was ok, until I noticed that the call to get the product information had a number on the end asking for number of product Ids sent in the first parameter which was a char **.

So then I recoded my game to send in all the product IDs as a batch. The only thing was the callback that receives the information seemed only to handle the information coming back as a singular entity. Nowhere could I find a reference as to how this is supposed to work. So I used logic to decide that the information must come back a single product at a time, even when asked for as a bundle.

So the last few days I have been playing with this idea and last night I was in fact able to prove that it does indeed work in that way. So now I ask in a bundle and process my results within the callback, and then I copy the relevant information to my shop packages array for displaying to the player.

It is all working really well, and apart from some reformatting of the shop screen I am very close to actually attempting a purchase of one of my products. Very exciting indeed.

Da Voodoochief

No comments:

Post a Comment