iOS Question RevenueCat stuck at Connect SDK

tsteward

Well-Known Member
Licensed User
Longtime User
I'm trying to setup RevenueCat and I'm stuck at Connect SDK. When I select it, it opens a new window with the documentation.

I have no idea with iOS subscriptions or revenueCat need assistance please.
 

Attachments

  • Screenshot 2024-10-28 195636.png
    Screenshot 2024-10-28 195636.png
    15.7 KB · Views: 10

tsteward

Well-Known Member
Licensed User
Longtime User
I have the following code but RevCatUserId is just an empty string. no GUID is created

B4X:
inAppPurchases.Initialize("inAppPurchase")
    KeyValue.Initialize(xui.DefaultFolder,"AppSettings") 'For saving relevant subscription data

    Dim RevCatUserId As String = KeyValue.GetDefault("RevCatUserId",RevCat.GUID) 'If no user guid is saved, then generate a new
    KeyValue.Put("RevCatUserId",RevCatUserId)
    Log(KeyValue.Get("RevCatUserId"))
    RevCat.Initialize("appl_KbpGgJnwZasKxJOgOdgxxxxxxxxx",RevCatUserId,Array As String("Pro"))
    CheckPurchases
 
Upvote 0

Alexander Stolte

Expert
Licensed User
Longtime User
I have updated the example project.
Please do the following:
Add this function:
B4X:
'Generates a new GUID
Public Sub GUID As String
    Dim sb As StringBuilder
    sb.Initialize
    For Each stp As Int In Array(8, 4, 4, 4, 12)
        If sb.Length > 0 Then sb.Append("-")
        For n = 1 To stp
            Dim c As Int = Rnd(0, 16)
            If c < 10 Then c = c + 48 Else c = c + 55
            sb.Append(Chr(c))
        Next
    Next
    Return sb.ToString
End Sub

And this is the updated code:
B4X:
    KeyValue.Initialize(xui.DefaultFolder,"AppSettings") 'For saving relevant subscription data
    Dim RevCatUserId As String = KeyValue.GetDefault("RevCatUserId",GUID) 'If no user guid is saved, then generate a new
    KeyValue.Put("RevCatUserId",RevCatUserId)
    RevCat.Initialize("RevenueCatAPIKey",RevCatUserId,Array As String("all_access_1_year","all_access_1_month"))
    CheckPurchases
 
Upvote 0

tsteward

Well-Known Member
Licensed User
Longtime User
Reset the keyvalue store with:
B4X:
KeyValue.Remove("RevCatUserId")

and try it with the updated code in #4
Of course thank you.

Okay thats seems to be working and connect to sdk has now cleared.
There is one new user showing in the revenue cat site.
Now just to figure out processing the subscription. I stuffed something as product not found LoL
 
Upvote 0

Alexander Stolte

Expert
Licensed User
Longtime User
Now just to figure out processing the subscription.
Have a look at the example project in the xlbl_Purchase_Click.

If you need a nice user interface to show the premium features and the prices, then have a look at this view:
 
Upvote 0

Alexander Stolte

Expert
Licensed User
Longtime User
but get product not found
I had the same problem back then, the solution was as following stackoverflow thread:
 
Upvote 0
Top