Hello, I’m trying to get App Store Promotions for In-App Purchases working through RevenueCat. I feel like I must be missing a permission or some important setup call somewhere, because I just can’t seem to get the delegate purchases method containing readyForPromotedProduct
to ever be called when opening an App Store Promotions link (e.g. itms-services://?action=purchaseIntent&bundleId=<BUNDLE_ID_HERE>&productIdentifier=<PRODUCT_ID_HERE>
).
I’ve confirmed that the normal purchases method (func purchases(_ purchases: Purchases, receivedUpdated customerInfo: CustomerInfo)
) gets called every start, but not the one I want.
I’ve tried all the following sources:
- RevenueCat documentation for
readyForPromotedProduct
- Two different RevenueCat examples (MockPurchasesDelegate.swift, PurchasesDelegateHandler.swift)
- The following community threads:
Here is my Swift code:
final class PurchasesDelegateHandler: NSObject, Sendable {
static let shared = PurchasesDelegateHandler()
}
extension PurchasesDelegateHandler: PurchasesDelegate {
/// Whenever the `shared` instance of Purchases updates the CustomerInfo cache, this method will be called.
///
/// - Note: CustomerInfo is not pushed to each Purchases client, it has to be fetched.
/// This delegate method is only called when the SDK updates its cache after an app launch, purchase, restore, or fetch.
/// You still need to call `Purchases.shared.customerInfo` to fetch CustomerInfo regularly.
func purchases(_ purchases: Purchases, receivedUpdated customerInfo: CustomerInfo) {
/// - Update our published customerInfo object
SGSnackBar().show(text: "Normal purchases method", duration: 10)
}
/// - Note: this can be tested by opening a link like:
/// itms-services://?action=purchaseIntent&bundleId=<BUNDLE_ID>&productIdentifier=<SKPRODUCT_ID>
func purchases(
_ purchases: Purchases,
readyForPromotedProduct product: StoreProduct,
purchase startPurchase: @escaping StartPurchaseBlock)
{
SGSnackBar().show(text: "Secondary purchases method!", duration: 10)
}
}
// Inside my PurchasesManager class…
Purchases.configure(withAPIKey: PurchasesStrings.Manager.Key.providerAPI, appUserID: userID)
Purchases.shared.delegate = PurchasesDelegateHandler()