require("store") is returning a nil value

Bump, this is unfortunately fairly urgent and is holding up my current project. Are there any ideas?

Can you tell me more about the device you are trying to run this on?   Do you have it set to now allow apps to make purchases?

Can you try and build the IAP sample app and install it and see if you have problems with it?

Thanks

Rob

Not sure what you mean by “now allow apps to make purchases”. It’s an iPad 2 enabled for development, running iOS 7.0.3. I’m building using a Pro version of Corona with a provisioning profile setup with iAPs enabled.

Never mind.  I thought there was a parental control that prevented purchases, but I can’t find it, so it must just be the password prompt.

Any way, can you try the sample app?

Thanks

Rob

Starters don’t have access to in app purchases aka the store api.  You need to be a Basic, Pro, or Enterprise user.

Read my reply.

I’m building using a Pro version of Corona with a provisioning profile setup with iAPs enabled

This is my personal account, I’m developing the app for a client using their pro account. Aside from that, it wouldn’t initialize in the simulator if I wasn’t using pro, it would just print up an error message telling me I need pro.

I’m having the same issue.  I have a Basic Account and I get:

The store API is not supported on this platform.

…when I require the ‘store’ module.  Is this a possible bug that came up once the pricing structure was changed?

Please post a sample project where this issue happens.  Thanks.

Please try and build the iAP sample app and install it on your device and see if you’re having problems with it.

Thanks

Rob

Sample app built and seemed to of worked fine on the device. Here’s the output

Nov 22 23:53:38 iPAD InAppPurchase[1596] <Warning>: Using Apple’s in-app purchase system.

Nov 22 23:53:39 iPAD wifid[15] <Notice>: WiFi:[406875219.159456]: Client itunesstored set type to background application

Nov 22 23:53:39 iPAD wifid[15] <Notice>: WiFi:[406875219.161163]: BG Application: Not Present, BG Daemon: Present. Daemons: networkd itunesstored dataaccessd imagent apsd 

Nov 22 23:53:39 iPAD wifid[15] <Notice>: WiFi:[406875219.162126]: Already connected to QKFF9.

Nov 22 23:53:39 iPAD InAppPurchase[1596] <Warning>: After store.loadProducts, waiting for callback

Nov 22 23:53:40 iPAD securityd[75] <Error>: OCSPResponse: now + maxAge > latestNextUpdate, using latestNextUpdate

Nov 22 23:53:40 iPAD securityd[75] <Error>: OCSPResponse: now + maxAge > latestNextUpdate, using latestNextUpdate

Nov 22 23:53:40 iPAD InAppPurchase[1596] <Warning>: In loadProductsCallback()

Nov 22 23:53:40 iPAD InAppPurchase[1596] <Warning>: event, event.name    table: 0x17d6db20    productList

Nov 22 23:53:40 iPAD InAppPurchase[1596] <Warning>: table: 0x17d87ac0

Nov 22 23:53:40 iPAD InAppPurchase[1596] <Warning>: #event.products    0

Nov 22 23:53:40 iPAD InAppPurchase[1596] <Warning>: Loading product list

Nov 22 23:53:45 iPAD wifid[15] <Notice>: WiFi:[406875225.242088]: Client itunesstored set type to normal application

Nov 22 23:53:45 iPAD wifid[15] <Notice>: WiFi:[406875225.243606]: BG Application: Not Present, BG Daemon: Present. Daemons: networkd dataaccessd imagent apsd 

Nov 22 23:54:24 iPAD wifid[15] <Notice>: WiFi:[406875264.790004]: ManagerClient[“aggregated”] setProperty[“LoggingEnabled”] = FALSE

However, I got a message “In-App purchases is not supported on this device.” inside the app.

After this I re-built the previous app, here’s the output:

Nov 22 23:57:19 iPAD Prototype_App[1622] <Warning>: Active: nil

Nov 22 23:57:19 iPAD Prototype_App[1622] <Warning>: Runtime error

    …ts/iPadApp/Prototype_App/magstore.lua:86: attempt to call field ‘init’ (a nil value)

    stack traceback:

        [C]: ?

        [C]: in function ‘error’

        ?: in function ‘gotoScene’

        …ojects/iPadApp/Prototype_App/main.lua:383: in main chunk

Nov 22 23:57:19 iPAD Prototype_App[1622] <Warning>: Runtime error

    

    stack traceback:

        [C]: ?

        [C]: in function ‘error’

        ?: in function ‘gotoScene’

        …ojects/iPadApp/Prototype_App/main.lua:383: in main chunk

I confirmed that it’s using almost the same code in both lua files… the store variable is never getting overridden anywhere either.

I confirm that the sample project “inAppPurchase” is throwing the same error:

“The store API is not supported on this platform.”

And the “Licensing” sample doesn’t seem to do anything in the simulator. 

I’m currently using build: Version 2013.1202.  I’ve attempted to upgrade to the latest build, 2013.2076, however this won’t run all of my older applications, as it requires migration to the Graphics 2.0 API.  So it appears I’m either forces to migrate all of my apps or work without access to the store module. 

We’re literally losing money by the day on this one, so if there’s anything you can offer, besides asking us to test your sample applications for you, please let us know.

 

@loughrank, you should be able to run 2076 is v1 compatibility mode and only have minor fixes to do.  Make sure you add:

graphicsCompatibility = 1

in your config.lua at the same place you set your width and height.  However, the offering of the Basic subscription is all managed on the server side and 1202 should not be issuing this problem. 

I’ll have to ask the engineer’s whats going on here. 

Rob

Thanks for the tip!  However, I obviously shouldn’t have to go back and migrate all my apps because there is a bug in 1202, so if possible, please look into the issue.

We cannot go back and patch older release versions.  We make fixes and produce a new release version that has all of the bugs that were fixed as well as any new features that are added.   Build 2076, the current public build is 1202 with all of the fixes since it was released.

If you must avoid G2 (The v1 compatibility flag and the old - now - open source sprite library should take care of most everything for you) then you could upgrade to a Pro subscriber and use the last daily build before we went to G2. That build is 1260.  We had the folks who build the game Major Magnet upgrade it to 2.0 and it was hyper easy.  See this blog post:

http://www.coronalabs.com/blog/2013/11/20/tutorial-fast-migration-of-graphics-1-0-based-projects-to-graphics-2-0/

Rob

You’re just not calling this a “bug” are you? I’m using an older version of Corona, which I thought might of been the problem. So I actually updated to the latest version and I still was getting the exact same error. So I rolled back to the older version.

Any other ideas/suggestions?

I’m not calling it a bug in our code yet, but I’ve asked engineering to look into it, but they don’t generally work on weekends, so it will be sometime this week before they can look into it.

Rob

Thanks again Rob!  To follow up - I’ve found the store module works when I build to my device(s), but I’m not able to test in the Simulator as I had in previous builds. 

Any luck yet? If you have any other ideas on how I can help debug the issue, please let me know.

I apologize guys.  I’m very very confused about what your actual problem is now.  You cannot test the store.* API calls in the simulator.  OS-X/Windows does not have the requisite SDKs necessary to talk to the stores for devices.  You must do this on device.

Now @-Garet-, your OP said you were getting an error on the device, which you should not be getting.  Focusing on @-Garet-, you said above that our sample app does run on device, so this means the problem is somewhere in your code.  Would it be possible for you to post your magstore.lua file? 

You probably should also get a table printing function (like print_r) from the community code and print out (i.e. dump) your store table where you are getting that error and right after you do the require statement and see what messages show up in the console log.

Rob