iOS Question Wait For Issue

walterf25

Expert
Licensed User
Longtime User
Hi all, i'm trying to implement the in-app purchases library into an app, i am declaring the in-app purchase library in a code module like this:

B4X:
Sub Process_Globals
private pur As Store
End Sub

Sub fakefunction_InformationAvailable (Success As Boolean, Products As List)
    If Success Then
        For Each p As ProductInformation In Products
            LogColor("product available: " & p.LocalizedPrice, Colors.Magenta)
        Next
    End If
End Sub

From the Main Page i am calling my pur variable like this.
B4X:
dim productss As List
productss.Initialize
productss.Add("xxxxxxxx")
PurchaseModule.pur.Initialize("fakefunction")
PurchaseModule.pur.RequestProductsInformation(Productss)
wait for (PurchaseModule.fakefunction_InformationAvailable(Success As Boolean, products As List)) ''I get an error here

on the Wait For Line, i get an error that says:
Main - 1522: Index was out of range. Must be non-negative and less than the size of the collection.<br />Parameter name: index

Why do I get this error, is this a bug in B4i, I mean this type of code works with B4A.

Note that the error I'm seeing doesn't even let me compile my code, any thoughts anyone?

Thanks,
Walter
 

walterf25

Expert
Licensed User
Longtime User
Thanks Erel, I figured it wasn't practical to call it from a code module, so I have moved that part of my code to the Main module, it works fine now.

Thanks
Walter
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…