Hi All,
Please can anyone help with this problem I’m currently having with regards to testing new items purchases, when testing my app i get the iTunes Store login popup, but after entering my tester user ID and its password, I get a second login prompt (coming from the iTunes Store) and after entering both again the transaction fails and my error event callback event returns " Cannot connect to iTunes Store" error. My testing account is included in my sandbox testing list of my iTunes Connect account and as far as I can tell I’ve think everything has been set up fine.
Here what is requested and then the returned information when a failed transaction happens:
Requested when transaction.state == “failed”:
print( event.transaction.errorType ); print( event.transaction.errorString );
Print out via Xcode:
Aug 19 02:19:53 Pythagoras-2 Water Jetters[370] \<Warning\>: unknown Aug 19 02:19:53 Pythagoras-2 Water Jetters[370] \<Warning\>: Cannot connect to iTunes Store
Here the transaction process in it entire:
function attributes.appleTransactionListener( event ) local transaction = event.transaction if ( transaction.state == "purchased" ) then --handle a successful transaction here print( "productIdentifier", transaction.productIdentifier ) print( "receipt", transaction.receipt ) print( "signature:", transaction.signature ) print( "transactionIdentifier", transaction.identifier ) print( "date", transaction.date ); if(attributes.index == 1)then local gold tonumber(\_G.uiStats.gold); gold = gold + 20000; \_G.uiStats.gold = gold; ragdogLib.setSaveValue("gold", \_G.uiStats.gold, true); elseif(attributes.index == 2)then local gold tonumber(\_G.uiStats.gold); gold = gold + 40000; \_G.uiStats.gold = gold; ragdogLib.setSaveValue("gold", \_G.uiStats.gold, true); elseif(attributes.index == 3)then local gold tonumber(\_G.uiStats.gold); gold = gold + 100000; \_G.uiStats.gold = gold; ragdogLib.setSaveValue("gold", \_G.uiStats.gold, true); elseif(attributes.index == 4)then local gems tonumber(\_G.uiStats.Gems); gems = gems + 25; \_G.uiStats.Gems = gems; ragdogLib.setSaveValue("gems", \_G.uiStats.Gems, true); end -- need to update on the screen gold in store afterexiting transactions native.showAlert( "Purchase", "Purchase was a success.", { "OK" } ); elseif ( transaction.state == "cancelled" ) then --handle a cancelled transaction here native.showAlert( "Purchase", "Purchase was canceled.", { "OK" } ); elseif ( transaction.state == "failed" ) then --handle a failed transaction here print( event.transaction.errorType ); print( event.transaction.errorString ); native.showAlert( "Purchase", "Purchase failed.", { "OK" } ); end store.finishTransaction( event.transaction ); end
attributes.purchaseRequest = function(itemNum) attributes.index = itemNum; if(attributes.devicePlatform == "Android")then store.purchase(attributes.productList[attributes.index]) -- item to purchase elseif(attributes.devicePlatform == "iPhone OS")then store.purchase({attributes.productList[attributes.index]}); --array of items end end
I’m at a complete loss with this and could do with any ones help thats been through this or has an idea as to what might be happening?
Please don’t hesitate to ask if you need more info.
Many thanks
Kind Regards
Liam
