Users unable to purchase consumables after initial purchase fails.

*Bump*

Has anyone made any progress on this?  Still not able to make a releasable app…

Has anyone else released an app recently?  Can you share what your versions of Corona and iOS are?

I think your problem is mixing .'s and :'s

function IAPContainer:create()     print("store init...")     self.store.init( "apple", self.transactionCallback ) end function IAPContainer:transactionCallback( event )

IAPContainer:transationCallback( event ) is really

IAPContainer.transactionCallback( self, event )

The IAP Code is not passing an object as the first parameter, it’s passing event as the first parameter and therefore event is nil, since it’s the first parameter and getting picked off as “self”.

I’m in the same boat.  I was doing a simple update to my app, and my binary got rejected because of this.  Here’s my code (note: I only edited out things that might be sensitive information or garbage in the logs like gesture warnings):

function IAPContainer:create() print("store init...") self.store.init( "apple", self.transactionCallback ) end function IAPContainer:transactionCallback( event ) print("=============okay?") print(event) if event then local transaction = event.transaction if event.transaction.state == "purchased" then if (transaction.productIdentifier == self.productIdentifiers[1]) then fortuneContainer:add() end elseif event.transaction.state == "cancelled" then elseif event.transaction.state == "failed" then -- something went wrong native.showAlert( "Transaction Failed", "Try again later.", { "OK" } ) else -- something went wrong native.showAlert( "Transaction Failed", "Try again later.", { "OK" } ) end self.store.finishTransaction( event.transaction ) else print("!!! not okay") end end function IAPContainer:buy(productID) productId = self.productIdentifiers[1] if self.store.isActive == false then native.showAlert("Store purchases are not available. Verify that in-app purchases are enabled and try again later.", {"OK"}) elseif self.store.canMakePurchases == false then native.showAlert("Store purchases are not available. Verify that in-app purchases are enabled and try again later.", {"OK"}) elseif productId then -- print("Purchasing " .. tostring(productId)) self.store.purchase( {productId} ) end end

This is what I get from the console output:

Aug 21 14:06:20 MyDeviceName MyAppName[295] \<Error\>: assertion failed: 12H321: libxpc.dylib + 51867 [3C761F5E-F2FD-315B-895A-4054CAE2232E]: 0x7d Aug 21 14:06:20 MyDeviceName Unknown[295] \<Error\>: Aug 21 14:06:20 MyDeviceName MyAppName[295] \<Warning\>: Platform: iPod touch / iPod5,1 / 8.4.1 / PowerVR SGX 543 / OpenGL ES 2.0 IMGSGX543-115.5 / 2015.2697 Aug 21 14:06:20 MyDeviceName MyAppName[295] \<Warning\>: making store... Aug 21 14:06:20 MyDeviceName MyAppName[295] \<Warning\>: store init... Aug 21 14:06:22 MyDeviceName MyAppName[295] \<Warning\>: =============okay? Aug 21 14:06:22 MyDeviceName MyAppName[295] \<Warning\>: nil Aug 21 14:06:22 MyDeviceName MyAppName[295] \<Warning\>: !!! not okay Aug 21 14:06:22 MyDeviceName MyAppName[295] \<Warning\>: =============okay? Aug 21 14:06:22 MyDeviceName MyAppName[295] \<Warning\>: nil Aug 21 14:06:22 MyDeviceName MyAppName[295] \<Warning\>: !!! not okay Aug 21 14:06:22 MyDeviceName MyAppName[295] \<Warning\>: =============okay? Aug 21 14:06:22 MyDeviceName MyAppName[295] \<Warning\>: nil Aug 21 14:06:22 MyDeviceName MyAppName[295] \<Warning\>: !!! not okay Aug 21 14:06:22 MyDeviceName MyAppName[295] \<Warning\>: =============okay? Aug 21 14:06:22 MyDeviceName MyAppName[295] \<Warning\>: nil Aug 21 14:06:22 MyDeviceName MyAppName[295] \<Warning\>: !!! not okay Aug 21 14:06:22 MyDeviceName MyAppName[295] \<Warning\>: =============okay? Aug 21 14:06:22 MyDeviceName MyAppName[295] \<Warning\>: nil Aug 21 14:06:22 MyDeviceName MyAppName[295] \<Warning\>: !!! not okay Aug 21 14:06:23 MyDeviceName itunescloudd[148] \<Warning\>: Updating media purchase history for initial load... Aug 21 14:06:24 MyDeviceName ubd[157] \<Error\>: account is still enabled for ubiquity! Aug 21 14:06:24 MyDeviceName ubd[157] \<Error\>: account is still enabled for ubiquity! Aug 21 14:06:37 MyDeviceName ubd[157] \<Error\>: account is still enabled for ubiquity! Aug 21 14:06:37 MyDeviceName ubd[157] \<Error\>: account is still enabled for ubiquity! Aug 21 14:06:37 MyDeviceName syncdefaultsd[287] \<Notice\>: (Note ) SYDAccount: no account Aug 21 14:06:37 MyDeviceName itunesstored[83] \<Warning\>: Could not load library [21] Aug 21 14:06:37 MyDeviceName kernel[0] \<Notice\>: AppleKeyStore: operation failed \<removed possibly sensitive data\> Aug 21 14:06:37 MyDeviceName itunescloudd[148] \<Warning\>: Updating media purchase history for initial load... Aug 21 14:06:38 MyDeviceName itunescloudd[148] \<Warning\>: Updating media purchase history for initial load... Aug 21 14:06:38 MyDeviceName accountsd[82] \<Warning\>: [Warning] Unhandled server key: alert Aug 21 14:06:38 MyDeviceName accountsd[82] \<Warning\>: AIDA Notification plugin running Aug 21 14:06:38 MyDeviceName kernel[0] \<Notice\>: AppleAP3GDL::handleInterrupt2 FIFO is Empty Aug 21 14:06:39 MyDeviceName kernel[0] \<Notice\>: AppleKeyStore: operation failed \<removed possibly sensitive data\> Aug 21 14:06:39 MyDeviceName backupd[300] \<Warning\>: INFO: Account changed (enabled=0, accountID=219936675) Aug 21 14:06:39 MyDeviceName kernel[0] \<Notice\>: AppleKeyStore: operation failed \<removed possibly sensitive data\> Aug 21 14:06:39 MyDeviceName syncdefaultsd[287] \<Notice\>: (Note ) SYDAccount: no account Aug 21 14:06:39 MyDeviceName syncdefaultsd[287] \<Notice\>: (Note ) SYDAccount: no account

Basically, something’s going wrong in the startup, and it’s calling the callback with “nil” instead of the event, which probably breaks things under the hood with Corona as well.  After that, when I attempt to buy stuff, everything looks like it’s working.  I get the “Buy items for $.99” screen and accept, but then, I get an the screen about “In-apps will be restored for free.”  The “store.isActive” is returning true, but it’s failing to buy.  The buy calls never trigger the transactionCallback (like, not even to pass nil for the event like it does at startup).

Oh, btw, IAPContainer is an implementation of a simple class in my code and “store” is this:

IAPContainer.store = require("store")

Hi @tjsamson,

How are you calling that “:create()” function? Is there a specific reason you decided to implement the store in this class setup?

Thanks,

Brent

@brent,  the entirety of my class setup is for ease of programming for me.  I prefer OOP for modeling the types of stuff I make, and it makes things like IAP very simple, modular, and self-contained.  I use this same class throughout all my products.  This is called once, right at the start of my app when I set things up in the main.lua.  It looks like this:

local storyboard = require "storyboard" require("theme") -- my class for themeing my app require("transitioncover") -- for transitions require("iapcontainer") -- the aforementioned IAP class require("advertiser") -- a class I made for using ads (which I'm not using right now) iapContainer = IAPContainer() iapContainer:create()

As you can see, it’s only called once, right at the start. I could throw in a debug log to prove that, if that would be of use.

As a note, it was working up until I updated to this version (I would have to do some digging to verify exactly when it broke, and that might be a product of iOS 8.4, not Corona).  Though, I don’t believe it worked with the latest prod build before I upgraded.

I’m building with 2015.8.15, targeting Mobile/iPad, with iOS SDK 8.4, btw.

*Bump*

Has anyone made any progress on this?  Still not able to make a releasable app…

Has anyone else released an app recently?  Can you share what your versions of Corona and iOS are?

I think your problem is mixing .'s and :'s

function IAPContainer:create() &nbsp;&nbsp;&nbsp;&nbsp;print("store init...") &nbsp;&nbsp;&nbsp;&nbsp;self.store.init( "apple", self.transactionCallback ) end function IAPContainer:transactionCallback( event )

IAPContainer:transationCallback( event ) is really

IAPContainer.transactionCallback( self, event )

The IAP Code is not passing an object as the first parameter, it’s passing event as the first parameter and therefore event is nil, since it’s the first parameter and getting picked off as “self”.