Hello to anyone that can help,
So I have an issue withe the store.restore() not working in sandbox for non-renewing subscriptions and I can’t figure out why.
So here is what the device console says when I try to do a restore:
Cannot check access to a private account type: com.apple.account.IMAPNotes
May 24 15:52:43 Grays-iPhone nMoon[9393] \<Warning\>: restore May 24 15:52:43 Grays-iPhone nMoon[9393] \<Warning\>: store is apple May 24 15:52:43 Grays-iPhone nMoon[9393] \<Warning\>: Attemting to Restore May 24 15:52:44 Grays-iPhone accountsd[83] \<Notice\>: 2014-05-24 15:52:44.284 accountsd[83:36527]: Cannot check access to a private account type: com.apple.account.IMAPNotes May 24 15:52:44 Grays-iPhone accountsd[83] \<Notice\>: 2014-05-24 15:52:44.289 accountsd[83:36527]: Cannot check access to a private account type: com.apple.account.IMAPNotes May 24 15:52:44 Grays-iPhone accountsd[83] \<Notice\>: 2014-05-24 15:52:44.294 accountsd[83:36527]: Cannot check access to a private account type: com.apple.account.IMAPNotes
This is how I am implementing it (I have used this successfully in another app using consumable IAP) I would think that I could just call store.restore() and it would get the info from apple and at least print in the “transaction.state == “restored”” but I docent even call the “function storeTransaction( event )” at all. I have tried without buying a one year subscription and with buying one and I also have deleted the app and then restored within the 1 hour sandbox time limit for a 1 year non-renewing subscription.
function IAP\_button( event ) local store = require( "store" ) local button\_id = event.target.id print("button ID",button\_id) function storeTransaction( event ) local transaction = event.transaction if ( transaction.state == "purchased" ) then --handle a successful transaction here print( "productIdentifier", transaction.productIdentifier, type(transaction.productIdentifier) ) print( "receipt", transaction.receipt, type(transaction.receipt) ) -- print( "signature:", transaction.signature, type(transaction.signature) ) print( "transactionIdentifier", transaction.identifier, type(transaction.identifier) ) print( "date", transaction.date, type(transaction.date) ) if button\_id == "1month" then IAP\_table.date\_purchased = encrypt(tonumber(os.time( timestamp )),7432) IAP\_table.date\_expires = encrypt(tonumber(os.time( timestamp )) + (5 \* 60), 7432) --2592000 elseif button\_id == "1year" then IAP\_table.date\_purchased = encrypt(tonumber(os.time( timestamp )), 7432)--["date\_purchased"] = nil, ["date\_expires"] = nil IAP\_table.date\_expires = encrypt(tonumber(os.time( timestamp )) + (60 \* 60), 7432) --31104000 end save\_IAP() elseif ( transaction.state == "restored" ) then --handle "restored" transactions here (iOS only) if (store.availableStores.apple) then print( "productIdentifier", transaction.productIdentifier, type(transaction.productIdentifier) ) print( "originalReceipt", transaction.originalReceipt, type(transaction.originalReceipt) ) print( "originalTransactionIdentifier", transaction.originalIdentifier, type(transaction.originalIdentifier) ) print( "originalDate", transaction.originalDate, type(transaction.originalDate) ) -- handle "restored" transactions here (google only) elseif ( store.availableStores.google ) then print("Transaction restored (from previous session)") print("productIdentifier", transaction.productIdentifier, type(transaction.originalDate)) print("receipt", transaction.receipt, type(transaction.receipt)) print("transactionIdentifier", transaction.identifier, type(transaction.identifier)) print("date", transaction.date, type(transaction.date)) end native.showAlert("Awesome!" , "Your subscription has been restored!" , {"Dismiss"}, none); elseif (transaction.state == "cancelled") then print ("Transaction cancelled; you may want to show an alert here"); elseif (transaction.state == "failed") then print ("Transaction failed"); native.showAlert("Oops!" , "Something went wrong. Please try again." , {"Dismiss"}, none); end store.finishTransaction( event.transaction ) native.setActivityIndicator(false); end if button\_id ~= "done" then print(button\_id) native.setActivityIndicator(true); end if ( store.availableStores.apple ) then print("store is apple") --productID = appleProductList store.init( "apple", storeTransaction ) elseif ( store.availableStores.google ) then print("store is google") --productID = googleProductList store.init( "google", storeTransaction ) else print( "In-app purchases are not supported on this system/device." ) if button\_id ~= "done" then native.showAlert("Oops!" , "In-app purchases are not supported on this system/device." , {"Dismiss"}, none); end native.setActivityIndicator(false); end if button\_id == "1month" then --store.purchase( { "android.test.purchased" } ) if ( store.availableStores.google ) then store.purchase( { "apiaccess1month" } ) end -- android.test.purchased if ( store.availableStores.apple ) then store.purchase( { "APIAccess1month" } ) end elseif button\_id == "1year" then if ( store.availableStores.google ) then store.purchase( { "apiaccess1year" } ) end -- android.test.purchased if ( store.availableStores.apple ) then store.purchase( { "APIAccess1year" } ) end elseif button\_id == "restore" then print("Attemting to Restore") native.setActivityIndicator(false); store.restore() elseif button\_id == "done" then IAP\_group.isVisible = false end return true end
Any help is greatly appreciated!