Question

cant get revenue cat installed

  • 24 November 2022
  • 6 replies
  • 57 views

Badge +3

is there any phone support - I spend a day trying with both cocoa and swift package manager - nothing seems to work. 


6 replies

Userlevel 5
Badge +8

@brian mcdonald I replied in the other ticket you commented in (

), could you tell us more about the problems you’re facing? 

Badge +3

 I managed to install using swift package manager. The problem I have now is tutorials seem out of date - the updates have deprecated “Purchases.shared.products([productID!])” to Purchases.shared.getProducts” but now the  Purchases.shared.purchaseProduct does not accept SKProduct type and can’t convert to StoreProduct type. 

Is there a conversion call OR is there another version of Purchases.shared to use with StoreProduct type. 

Userlevel 5
Badge +8

I’m happy to update any documentation that we own, could you provide us links to the things that are out of date? 

As for purchasing: 

Purchases.shared.getProducts returns StoreProducts, so the objects returned from there should be the ones you pass in to Purchases.shared.purchaseProduct

Badge +3

This simple code generates a conversion “error Cannot convert value of type 'StoreProduct' to expected argument type 'SKProduct' “

Purchases.shared.getProducts([productID!]) { (products) in

                

                if !products.isEmpty {

                    

                    let skProduct = products[0]

                    

                    print("SkProduct \(skProduct)")

                    

                       Purchases.shared.purchaseProduct(skProduct) { (transaction , purchaserInfo, error, userCancelled) in

                        

                        if error == nil && !userCancelled {

                            

                            successfulPurchase()

                        }

                    }

Userlevel 5
Badge +8

Ohh, I see, my bad.

The new method that takes in a StoreProduct is actually this one: 

 

Purchases.shared.purchase(product: storeProduct), not Purchases.shared.purchaseProduct: skProduct)

 

I realize that this is confusing, I apologize. 

 

Badge +3

Thanks Andy, big help - I think its just getting started that’s hard. 

Reply