Runtime error on store.restore() after store.init()

I get a run-time error if I put store.restore(loadProductsCallback) after calling store.init(transactionCallback).

If I comment out store.restore() no error occurs.

logcat:

V/Corona ( 2669): \> Class.forName: plugin.amazon.iap.LuaLoader V/Corona ( 2669): \< Class.forName: plugin.amazon.iap.LuaLoader V/Corona ( 2669): Loading via reflection: plugin.amazon.iap.LuaLoader I/PurchasingManager( 2669): Purchasing Framework initialization complete. Build ID 1.0.3 D/PurchasingManager( 2669): In App Purchasing SDK - Sandbox Mode: PurchasingObserver registered: plugin.amazon.iap.CoronaPurchasingObserver@42062798 D/SandboxRequestHandler( 2669): In App Purchasing SDK - Sandbox Mode: sendGetUserIdRequest I/AmazonSDKTester( 1681): Sending UserId Response Broadcast ({"status":"SUCCESSFUL","requestId":"53fe8c4c-524e-4133-8d72-3cedd6863118","userId":"testuser"}) D/SandboxResponseHandler( 2669): In App Purchasing SDK - Sandbox Mode: handleResponse D/SandboxResponseHandler( 2669): In App Purchasing SDK - Sandbox Mode: Running Runnable for userIdResponse with requestId: 53fe8c4c-524e-4133-8d72-3cedd6863118 I/Corona ( 2669): Runtime error I/Corona ( 2669): com.naef.jnlua.LuaRuntimeException: This function requires 0 arguments I/Corona ( 2669): Java Stack Trace: I/Corona ( 2669): plugin.amazon.iap.LuaBridge.checkNumArgs(LuaBridge.java:418) I/Corona ( 2669): plugin.amazon.iap.LuaBridge.restore(LuaBridge.java:176) I/Corona ( 2669): plugin.amazon.iap.LuaBridge$RestoreWrapper.invoke(LuaBridge.java:243) I/Corona ( 2669): com.ansca.corona.JavaToNativeShim.nativeResize(Native Method) I/Corona ( 2669): com.ansca.corona.JavaToNativeShim.resize(JavaToNativeShim.java:258) I/Corona ( 2669): com.ansca.corona.opengl.CoronaGLSurfaceView$CoronaRenderer.onSurfaceChanged(CoronaGLSurfaceView.java:355) I/Corona ( 2669): com.ansca.corona.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1611) I/Corona ( 2669): com.ansca.corona.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1377) I/Corona ( 2669): stack traceback: I/Corona ( 2669): [C]: ? I/Corona ( 2669): [C]: in function 'restore' I/Corona ( 2669): ?: in function \<?:270\> I/Corona ( 2669): ?: in main chunk I/Corona ( 2669): [C]: in function 'require' I/Corona ( 2669): ?: in function 'require' I/Corona ( 2669): ?: in main chunk I/Corona ( 2669): [C]: in function 'require' I/Corona ( 2669): ?: in function 'require' I/Corona ( 2669): ?: in main chunk I/Corona ( 2669): [C]: in function 'require' I/Corona ( 2669): ?: in function 'require' I/Corona ( 2669): ?: in main chunk I/Corona ( 2669): Runtime error

Please note that I’ve tested this on a Nexus 7 with Android 4.3 and a Galaxy S running Android 2.3.6 both with the same result.

I have the Amazon SDK tester app installed and amazon.sdktester.json is in the proper place.

OK. I got it to work. I think there’s a typo in the sample code.

According to the sample you should call store.restore( loadProductsListener ). That will result in the error above. If I just call store.restore(); then it works as expected.

 
 

Hi ingemar,

Thank you for your feedback. This is indeed a mistake in the documentation which will be corrected soon.

-Preston

OK. I got it to work. I think there’s a typo in the sample code.

According to the sample you should call store.restore( loadProductsListener ). That will result in the error above. If I just call store.restore(); then it works as expected.

 
 

Hi ingemar,

Thank you for your feedback. This is indeed a mistake in the documentation which will be corrected soon.

-Preston