Bug? [NOT A BUG - SOLVED!] _TransactionsRestored NEVER seems to trigger

Andris

Active Member
Licensed User
Longtime User
Over the last week I've been trying to get store.RestoreTransactions to work in my app. It finally works perfectly, with a build uploaded to Apple Connect and app downloads via TestFlight. However, I had to totally circumvent _TransactionsRestored in order to make it work! It NEVER fires, even though a list of previous purchases is successfully downloaded. _TransactionsRestored should also be raised in the case where there are no purchases (see Erel's reply in this thread). Seems that it doesn't. It's almost as if the event is named something other than _TransactionsRestored ... has me baffled.

To get around the problem, I ended up starting/restarting a 1 second timer in each _PurchaseComplete event (which does always get raised). So after the last purchase downloads, I essentially create my own "_TransactionsRestored" event and do my processing.

Has anyone seen this problem? Maybe a B4i bug? I doubt that Apple is forgetting to send the event trigger ...
 

Andris

Active Member
Licensed User
Longtime User
Can you post the event sub?

I don't want to burden you with all the supporting code, but here's the event sub and the 1-second timer that I referred to in the previous post:

B4X:
Sub iAppStore_TransactionsRestored
   
    'ignore if connection timed out
    If ConnTimedOut=True Or ConnCanc=True Or RestDone=True Then
        Return
    Else
        tmrConn.Enabled=False  
    End If
   
    'disable tmrRestDone since store event has been raised
    tmrRestDone.Enabled=False
   
    ProcessRestoredPurchases
   
End Sub

Sub tmrRestDone_tick
   
    tmrRestDone.Enabled=False
    RestDone=True        'will disable iAppStore_TransactionsRestored event if it happens to trigger later
   
    ProcessRestoredPurchases
   
End Sub

tmrRestDone is enabled/restarted by each iAppStore_PurchaseCompleted event. 1 second after the last purchase is received, ProcessRestoredPurchases is executed, as should be the case with iAppStore_TransactionsRestored.

If I comment out lines as follows, ProcessRestoredPurchases never runs:

B4X:
Sub iAppStore_TransactionsRestored

     'ignore if connection timed out

'    If ConnTimedOut=True Or ConnCanc=True Or RestDone=True Then
'
'        Return
'
'   Else
'
'        tmrConn.Enabled=False  
'
'    End If
'
'    'disable tmrRestDone since store event has been raised
'
'    tmrRestDone.Enabled=False

    ProcessRestoredPurchases

End Sub

Sub tmrRestDone_tick
   
    tmrRestDone.Enabled=False
'    RestDone=True        'will disable iAppStore_TransactionsRestored event if it happens to trigger later
'   
'    ProcessRestoredPurchases
   
End Sub

Are there maybe some parameters returned by iAppStore_TransactionsRestored that I haven't sepecified? Like iAppStore_TransactionsRestored(success) or something like that? From all I've seen mentioned, iAppStore_TransactionsRestored seems to be all that's needed.
 

Andris

Active Member
Licensed User
Longtime User
Of course. Never guess the event parameters:

View attachment 98511

Let the IDE write the signature for you.

You can also see the events by hovering over the type name:

View attachment 98512

Oh wow. Of course I knew that. So used to getting the events from Designer, it totally slipped my mind!

I love that the Forum can always reset me back to "young and inexperienced." At my age, it's worth it at any cost LOL. Thanks for the help, as usual!
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…