Hi,
I’m implementing a game with IAP. (Apple). I managed to creating products and the user test account.
Currently the products are loaded and the test account on iTunes seems to work well as when I invoke the store.Purchase method, iTunes ask me for credentials and agreeing on the item purchase.
But despite I validated the purchase on iTunes popup, the callback event is never executed, so the application can not validated if purchase was successful or not.
The is my code in main.lua
local store = require( “store” )
function transactionCallback(event)
local transaction = event.transaction
local showMsgID = “”
print("transaction state "…transaction.state)
print("transaction error type "…transaction.errorType)
print("transaction error "…transaction.errorString)
status = transaction.state
if ( transaction.state == “purchased” ) then
print("transaction "…transaction.productIdentifier)
elseif ( transaction.state == “restored” ) then
elseif(transaction.state == “refund”) then
elseif ( transaction.state == “cancelled” ) then
elseif ( transaction.state == “failed” ) then
else
end
store.finishTransaction( transaction )
end
print(“init store”)
store.init(“apple”, transactionCallBack)
store.purchase({“com.xxx.xxxx.xxxx.xxxx”}) --<-- here comes the right product id
However, this is the result on the log:
Feb 25 06:15:48 iPhone MyGame[6371] <Warning>: init store
Feb 25 06:15:48 iPhone gamed[6202] <Warning>: 06:15:48.382444 NSLog: Application(com.xxx.xxxx.xxxx.xxxx) is not allowed to run in production
Feb 25 06:15:49 iPhone locationd[64] <Notice>: Gesture EnabledForTopCLient: 1, EnabledInDaemonSettings: 1
Feb 25 06:15:49 iPhone itunescloudd[6117] <Notice>: (Note ) MC: User has completed cloud configuration. Not showing UI again.
Feb 25 06:15:49 iPhone itunescloudd[6117] <Warning>: Updating media purchase history for initial load…
Feb 25 06:15:50 iPhone locationd[64] <Notice>: Gesture EnabledForTopCLient: 1, EnabledInDaemonSettings: 1
Feb 25 06:15:51 iPhone itunescloudd[6117] <Warning>: ============================== releasing power assertion: <CloudServerPowerAssertion: 0x14603100>
Feb 25 06:15:58 iPhone itunesstored[6119] <Warning>: Could not load library [21]
Feb 25 06:15:59 iPhone itunescloudd[6117] <Notice>: (Note ) MC: User has completed cloud configuration. Not showing UI again.
Feb 25 06:15:59 iPhone itunescloudd[6117] <Warning>: Updating media purchase history for initial load…
Feb 25 06:15:59 iPhone itunescloudd[6117] <Warning>: Updating media purchase history for initial load…
Feb 25 06:16:03 iPhone itunescloudd[6117] <Warning>: ============================== releasing power assertion: <CloudServerPowerAssertion: 0x14653df0>
Feb 25 06:16:03 iPhone itunescloudd[6117] <Warning>: ============================== releasing power assertion: <CloudServerPowerAssertion: 0x147c8c50>
As you can see only the “init store” message is printed. Despite I entered my test user credentials and agreed on all iTunes pop up windows the prints in the transaction event are not shown, thereby, callback is not executed
I appreciated any guidance on this.
Olman
PS:
Just a curiosity. When I start the app from the console I got this warning:
Corona SDK Warning
You will not be able to publish this app to the store because it uses a restricted library (store). Please upgrade to unlock it.
However, I have the basic account, so IAP is available.