problem with plugin.google.iap.v3

I’m getting a crash on load error when I load my app on a device. Basically, I can see the icon, I click the icon, I see the initial splash, then I see black. My test device is a Galaxy S3.

I (finally) figured out how to get adb to work and it says:

I/Corona  (29534): Runtime error

I/Corona  (29534): ?:0: attempt to index field ‘availableStores’ (a nil value)

I/Corona  (29534): stack traceback:

I/Corona  (29534): ?: in function ‘initialize’

I/Corona  (29534): ?: in main chunk

W/qdhwcomposer(  280): Excessive delay reading vsync: took 8527 ms

E/MP-Decision( 2374): num online cores: 2 reqd : 1 available : 4 rq_depth:0.000000 hotplug_avg_load_dw: 16

E/MP-Decision( 2374): DOWN cpu:1 core_idx:1 Ns:1.100000 Ts:190 rq:0.000000 seq:146.000000

E/Corona  (29534): ERROR: Unable to resolve host “stats.coronalabs.com”: No address associated with hostname

W/System.err(29534): java.net.UnknownHostException: Unable to resolve host “stats.coronalabs.com”: No address associated with hostname

W/System.err(29534): at java.net.InetAddress.lookupHostByName(InetAddress.java:424)

Here is the entry for the plugin:

plugins =

    {

        [“CoronaProvider.ads.iads”] =

        {

            publisherId = “com.coronalabs”,

            supportedPlatforms = { iphone=true, [“iphone-sim”]=true },

        },

        [“plugin.openssl”] =

        {

            publisherId = “com.coronalabs”

        },

        [“plugin.GameThrivePushNotifications”] =

        {

            publisherId = “com.gamethrive”,

        },

        [“plugin.google.play.services”] =

        {

                publisherId = “com.coronalabs”,

                supportedPlatforms = { android=true },

        },

        [“plugin.google.iap.v3”] =

        {

            publisherId = “com.coronalabs”,

            supportedPlatforms = { android=true },

        },

    },

(btw, the console is complaining about the openssl plugin wasting memory, I have no idea what that means)

Here is the require code:

local store = require(“store”)

if store.target == “google” then

store = require(“plugin.google.iap.v3”)

end

if store.target == “amazon” then

store = require(“plugin.amazon.iap”)

end

Here is the implementation code in function “initialize”:

else

  if store.availableStores.apple then

     timer.performWithDelay(1000, function() store.init( “apple”, transactionCallback); end)

  end

  if store.availableStores.google then

     timer.performWithDelay( 1000,

     function()

        store.init( “google”, transactionCallback );

        restoring = true;

        store.restore();

     end )

  end

end

I don’t see the problem, I hope you can see something I missed. Most of this is cut and paste from tutorials on your site. The last time I had a problem that only existed on the device it was because I had used an upper case letter for a file name. Your emulator doesn’t care about case sensitivity for file names but the iPhone did. I am now getting a similar error on a Galaxy S3.

It seems that the issue is simply that the function “availableStores” is not part of the plugin.google.iap.v3.

This means that the documentation for in-app purchases needs to be updated.

V3 doesn’t provide that API call.  See http://docs.coronalabs.com/guide/monetization/IAP/index.html#platform-detection

for more details on how to properly detect the store’s availability.

Rob

It seems that the issue is simply that the function “availableStores” is not part of the plugin.google.iap.v3.

This means that the documentation for in-app purchases needs to be updated.

V3 doesn’t provide that API call.  See http://docs.coronalabs.com/guide/monetization/IAP/index.html#platform-detection

for more details on how to properly detect the store’s availability.

Rob