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 CASAFlightData[56957:3007853] [Purchases] - DEBUG: ā¹ļø No existing requests and products not cached, starting SKProducts request for: ["CN_235_Monthly299"]
2022-05-29 18:24:59.253793+0300 CASAFlightData[56957:3007853] [Purchases] - DEBUG: š» SKProductsRequest did finish
2022-05-29 18:24:59.253996+0300 CASAFlightData[56957:3008278] [Purchases] - 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([productId!]) { (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.