[SOLVED] Issues with "Product ID" on iOS

GuyCockcroft

  • Posts: 193
Hi Stencylers! I'm coming to the end of the road with a little game I've been making. And am now tackling in-app purchases on iOS. I'm on Stencyl version 9283.

I have 4 IAPs, and I'm having trouble with the Product ID. I have set it up as per the guide - so that I make a product request, and check the IDs in code, and allow purchase of the relevant IAPs when they match up. I can successfully display the description of the IAPs so I know my info request has been processed, but I'm not sure what I should be doing to the Product ID. If I try to display the product ID in text (so I know what I'm checking against), I get a compile error (Unknown identifier : productID).

So, my question, really, is what format is the product ID in? They are just names I typed into iTunes Connect, so I'd expect them to be text, but with there being more than one, I'm not sure. A list/array?

Really hoping somebody can help me with this - as it's one of the last hurdles to overcome, and then I'm finished!

Thanks

« Last Edit: March 25, 2017, 06:20:54 pm by GuyCockcroft »

colburt187

  • *
  • Posts: 2416
Ive attached what my iap buy code looks like. I just have 1 to remove adverts. the ID is what I have called it in iTunes connect.

GuyCockcroft

  • Posts: 193
Thank you. But the issue isn't with buying the IAPs themselves - this works fine. I can buy specific IAPs by specifying their product IDs in the buy block.

But when there are more than one, I can't distinguish between them to determine what to do when using the restore purchases block, or the "request product info" block. Despite me doing what is suggested in the Stencyl guide, it doesn't work. (Attached are screenshots showing what I'm trying to do)

Many thanks for any help you can offer.

colburt187

  • *
  • Posts: 2416
Hmm, I haven't worked with multiple iaps before. I just use the request info block once in the very first scene of my game. I also don't use attributes to track my iaps so i don't need to take any action when the purchase is restored. I use the purchase block itself as a bool.

Ive noticed the restore purchase function isn't working in my most recent game, it feels like an error on apples side though.

GuyCockcroft

  • Posts: 193
Yeah. It's very odd because I can request the title, description, and price of each one. I know that my "restore purchases" code does actually run because it does other things that are not specific to a certain iap (such as playing a sound). It's just that I can't seem to find a way of determining what to do with each iap product ID at that point.

Thanks again.

colburt187

  • *
  • Posts: 2416
For restoring purchases, if someone presses the button, it will restore any purchases made, you don't need to take any action. But I guess you need to know to set the bools?


colburt187

  • *
  • Posts: 2416
Would using the iap as the bool itself not work with your set up, as in the image I attached?

GuyCockcroft

  • Posts: 193
That is essentially what I'm doing  in my restore purchase block. No dice.

colburt187

  • *
  • Posts: 2416
Place it in an always event or something. I've never used any of those specific iap event blocks

GuyCockcroft

  • Posts: 193
I'm pretty sure that that will have disasterous consequences. If the device is set to disable iaps. Or there is no data connection etc.

GuyCockcroft

  • Posts: 193
But, yes, I can experiment a bit with that block.  Cheers.

colburt187

  • *
  • Posts: 2416
Hmm yeah, I'm not sure I fully understand the situation, my iap set up is extremely simple but works fine. I guess it's your other iap that is making things more complex.

GuyCockcroft

  • Posts: 193
Yeah. Must be a common problem though, I would have thought.

colburt187

  • *
  • Posts: 2416
Are you sure you need the global attributes though? if setting them is where the issue lies then I would remove them if possible.