ios – Using async/await for Apphud


I’m trying to convert my Swift code to use async/await. I’m calling the function:

let result = await Apphud.purchase(productId)

but I’m getting the error

Cannot convert value of type ‘String’ to expected argument type ‘ApphudProduct’

when I build.

I notice that the Apphud SDK has a function purchase(productId) where it takes a string (which I need) but that’s deprecated.

Here’s the function from the Apphud SDK:

@MainActor @objc(purchaseById:callback:)
public static func purchase(_ productId: String, callback: ((ApphudPurchaseResult) -> Void)?) {
    ApphudInternal.shared.purchase(productId: productId, product: nil, validate: true, callback: callback)
}

Can someone please help?

Latest articles

spot_imgspot_img

Related articles

Leave a reply

Please enter your comment!
Please enter your name here

spot_imgspot_img