loadProducts callback apparently never executes

I’m having a tough time with store.loadProducts. I’m sending it a list of two items, one valid and one fake. The “before” and “after” messages print out, but none of the messages within the callback are displaying, not even the “entered” and “leaving” messages.

I’m using the code below, adapted from http://docs.coronalabs.com/api/library/store/loadProducts.html (“dprint” is just a function to print to the device display).

I thought it might be because I was using a Development provisioning certificate, so I created an Ad Hoc certificate and built with that, but the results are the same. Any ideas?

[lua] dprint(“Before loadProducts”)

local listOfProducts = {“com.unterra.enneaglyphs.lockbutton”, “lockbutton”}

local function productCallback( event )
dprint(“Entered callback”)

dprint(“showing valid products” … #event.products)
for i=1, #event.products do
dprint(event.products[i].title) – This is a string.
dprint(event.products[i].description) – This is a string.
dprint(event.products[i].price) – This is a number.
dprint(event.products[i].localizedPrice) – This is a string.
dprint(event.products[i].productIdentifier) – This is a string.
end

dprint(“showing invalidProducts” … #event.invalidProducts)
for i=1, #event.invalidProducts do
dprint(event.invalidProducts[i])
end

dprint(“Leaving callback”)
end

store.loadProducts( listOfProducts, productCallback )

dprint(“After loadProducts”)[/lua]
[import]uid: 117162 topic_id: 29919 reply_id: 329919[/import]

@gtellgtell, I don’t know why the productCallback isn’t firing. Just in case… do you require store at the top, like so: local store = require “store”

Naomi [import]uid: 67217 topic_id: 29919 reply_id: 119954[/import]

Hi Naomi – I’ve seen a lot of your posts while reading in the In-App Purchase forum today!

I do have the require statement, though it’s in my main.lua and not declared local (so as to be accessible from all modules).

Other info that might be relevant:

* The device I’m testing on does have an active wireless connection.

* I created the In-App Purchase item earlier today, but I don’t think the up-to-24-hours activation delay should be relevant here because I’m not trying to purchase it, only to find out whether it’s available for sale.

Don’t know if that will give you any further ideas, but at any rate thanks for checking out this thread!
[import]uid: 117162 topic_id: 29919 reply_id: 119998[/import]

You know, it just occurred to me – I was running the app using my normal login instead of a sandbox test user. Since the IAP isn’t actually part of a reviewed app for sale, maybe I need to try running it after signing out my main account. I was thinking I’d only need test user accounts for purchases and restores, but maybe it’s worth a try.
[import]uid: 117162 topic_id: 29919 reply_id: 119999[/import]

@gtellgtell, do you call store.loadProducts function in main.lua or elsewhere? Mine is called in main.lua – and what I have in other modules (where users actually purchase things) is store.purchase function.

About signing in as a test user, I think it’s probably best ( just to make sure IAP gets tested properly ). That said, I think store related functions fire regardless.

Naomi

Edit: One more thing. Just in case… could it be possible you’ve got a typo with the function name? Otherwise, it feels too strange for the function not to fire at all… [import]uid: 67217 topic_id: 29919 reply_id: 120007[/import]

I think I’ve got it! Apparently store.init() is required beforehand – which makes sense, but I somehow got the idea that init() was only needed for specific functions so I didn’t include it. My app is retrieving the information now. Thanks for your help! [import]uid: 117162 topic_id: 29919 reply_id: 120064[/import]

Hey, @gtellgtell, glad to hear you got it sorted!

Naomi [import]uid: 67217 topic_id: 29919 reply_id: 120084[/import]

@gtellgtell, I don’t know why the productCallback isn’t firing. Just in case… do you require store at the top, like so: local store = require “store”

Naomi [import]uid: 67217 topic_id: 29919 reply_id: 119954[/import]

Hi Naomi – I’ve seen a lot of your posts while reading in the In-App Purchase forum today!

I do have the require statement, though it’s in my main.lua and not declared local (so as to be accessible from all modules).

Other info that might be relevant:

* The device I’m testing on does have an active wireless connection.

* I created the In-App Purchase item earlier today, but I don’t think the up-to-24-hours activation delay should be relevant here because I’m not trying to purchase it, only to find out whether it’s available for sale.

Don’t know if that will give you any further ideas, but at any rate thanks for checking out this thread!
[import]uid: 117162 topic_id: 29919 reply_id: 119998[/import]

You know, it just occurred to me – I was running the app using my normal login instead of a sandbox test user. Since the IAP isn’t actually part of a reviewed app for sale, maybe I need to try running it after signing out my main account. I was thinking I’d only need test user accounts for purchases and restores, but maybe it’s worth a try.
[import]uid: 117162 topic_id: 29919 reply_id: 119999[/import]

@gtellgtell, do you call store.loadProducts function in main.lua or elsewhere? Mine is called in main.lua – and what I have in other modules (where users actually purchase things) is store.purchase function.

About signing in as a test user, I think it’s probably best ( just to make sure IAP gets tested properly ). That said, I think store related functions fire regardless.

Naomi

Edit: One more thing. Just in case… could it be possible you’ve got a typo with the function name? Otherwise, it feels too strange for the function not to fire at all… [import]uid: 67217 topic_id: 29919 reply_id: 120007[/import]

I think I’ve got it! Apparently store.init() is required beforehand – which makes sense, but I somehow got the idea that init() was only needed for specific functions so I didn’t include it. My app is retrieving the information now. Thanks for your help! [import]uid: 117162 topic_id: 29919 reply_id: 120064[/import]

Hey, @gtellgtell, glad to hear you got it sorted!

Naomi [import]uid: 67217 topic_id: 29919 reply_id: 120084[/import]