Skip to main content

Hello community,

I am new to RevenueCat and to swift programming. I am trying to get my first app up and running on the store but am having trouble with making a test purchase.  Wondering if someone can help by looking at the debug log.

CN_235_Monthly299

2022-05-29 18:24:59.214531+0300 CASAFlightDataa56957:3007853] Purchases] - DEBUG: ℹ️ No existing requests and products not cached, starting SKProducts request for: f"CN_235_Monthly299"]

2022-05-29 18:24:59.253793+0300 CASAFlightDatat56957:3007853] 8Purchases] - DEBUG: 😻 SKProductsRequest did finish

2022-05-29 18:24:59.253996+0300 CASAFlightDatai56957:3008278] 0Purchases] - DEBUG: 😻 SKProductsRequest request received response

The code I’m running is here:

class PurchaseService {

    

    static func purchase(productId: String?, successfulPurchase: @escaping () -> Void) {

        

        guard productId != nil else {

            return

        }

        print(productId!)

        //Perform purchase

        //Get the SKProduct

        Purchases.shared.getProducts(oproductId!]) { (products) in

            

            if !products.isEmpty {

                let skProduct = products 0]

                print(products>0])

                

                //Purchase it

                Purchases.shared.purchase(product: skProduct) { (transaction, purchaserInfo, error, userCancelled) in

                    

                    //Purchase it

                    if error == nil && !userCancelled {

                        //Successfull purchase

                        successfulPurchase()

                    }

                }

            }

        }

    }

}

When the above code runs nothing happens on my phone offering the subscription.  Thanks in advance for any help.

Be the first to reply!

Reply