iOS Question InApp RequestProductsInformation question

Markos

Well-Known Member
Licensed User
Longtime User
Hi All,

I want to use the RequestProductsInformation method to allow changes in the product listing I define for InApp purchases to be seamless i n the iOS App. I am encountering an issue of the Type StoreProduct and Product as not defined. I thought it was owing to the fact that I was using v8.5 so I upgraded as I should do anyway to v10x to get the latest iStore. This still could not find the StoreProduct struct type. The code sample is shown below..

B4X:
Sub Process_Globals
 Public Store1 As Store
End Sub

Sub GetProductDetails
    Store1.RequestProductsInformation(productIDs)
End Sub

Sub Store1_ProductDetails (Success As Boolean, Products As Map)
    productlist.Clear
    productbuy.Clear
    If Success Then
        If Products.ContainsKey("com.progwhiz.someapp") Then
            For Each prd As StoreProduct In Products ' The error not finding StoreProduct happens here
                productlist.Add(prd.productid)
                'Log("Product Name: " & prd.Title)
                'Log("Product Price: " & prd.FormattedPrice)
            Next
        End If
    Else
        Log("Failed to connect to App Store")
    End If
End Sub

I initiate the call to GetProductDetails to trigger the events

Online I only see reference to the method RequestProductData but this does not exist in the Store object

If I am to simply use the ProductID's I created and explicitly call without using RequestProductsInformation then so be it but please advice
 
Last edited:

Markos

Well-Known Member
Licensed User
Longtime User
Hi All,

I want to use the RequestProductsInformation method to allow changes in the product listing I define for InApp purchases to be seamless i n the iOS App. I am encountering an issue of the Type StoreProduct and Product as not defined. I thought it was owing to the fact that I was using v8.5 so I upgraded as I should do anyway to v10x to get the latest iStore. This still could not find the StoreProduct struct type. The code sample is shown below..

B4X:
Sub Process_Globals
 Public Store1 As Store
End Sub

Sub GetProductDetails
    Store1.RequestProductsInformation(productIDs)
End Sub

Sub Store1_ProductDetails (Success As Boolean, Products As Map)
    productlist.Clear
    productbuy.Clear
    If Success Then
        If Products.ContainsKey("com.progwhiz.someapp") Then
            For Each prd As StoreProduct In Products ' The error not finding StoreProduct happens here
                productlist.Add(prd.productid)
                'Log("Product Name: " & prd.Title)
                'Log("Product Price: " & prd.FormattedPrice)
            Next
        End If
    Else
        Log("Failed to connect to App Store")
    End If
End Sub

I initiate the call to GetProductDetails to trigger the events

Online I only see reference to the method RequestProductData but this does not exist in the Store object

If I am to simply use the ProductID's I created and explicitly call without using RequestProductsInformation then so be it but please advice
Ok I found the answer I hope in 2 parts
1. Use InformationAvailable as the event name for the method RequestProductsInformation
2. Use ProductInformation instead of StoreProduct

Resulting in the following code for the Event

B4X:
Sub Store1_InformationAvailable (Success As Boolean, Products As Map)
    productlist.Clear
    productbuy.Clear
    If Success Then
        If Products.ContainsKey("com.progwhiz.someapp") Then
            For Each prd As ProductInformation  In Products
                Log("Product Name: " & prd.Title)
                Log("Product Price: " & prd.LocalizedPrice)
            Next
        End If
    Else
        Log("Failed to connect to App Store")
    End If
End Sub
 
Last edited:
Upvote 0
Top