London Escorts sunderland escorts 1v1.lol unblocked yohoho 76 https://www.symbaloo.com/mix/yohoho?lang=EN yohoho https://www.symbaloo.com/mix/agariounblockedpvp https://yohoho-io.app/ https://www.symbaloo.com/mix/agariounblockedschool1?lang=EN
0 C
New York
Monday, February 3, 2025

ios – Do IAP buttons have callbacks?


I am utilizing RevenueCat for subscriptions. It really works advantageous once I make the check buy however I am having an odd downside. I’ve a separate “Buy” button, when pressed, the RevenueCat motion sheet seems.

If I press the little x button in the precise hand nook to dismiss it or press exterior of the actionSheet, inside Purchases.shared.buy, .purchaseCancelledError will get referred to as. Nonetheless if I press the blue Subscription button, after which press the alert’s Okay, button, nothing occurs. No callbacks get triggered and I do not know that the person bought a subscription.

How can I do know when the person hits the Subscribe then pressed the OK button from the You are All Set alert?

func purchaseButtonTapped() {

    let productID = "..."

    Purchases.shared.getOfferings { [weak self](choices, error) in
        guard let _ = error else { return }

        for dict in choices.all {
                
            let providing = dict.worth
            let packages = providing.availablePackages
                
            if let indexOfItem = packages.firstIndex(the place: { $0.storeProduct.productIdentifier == productID }) {
                    
                let pkg = packages[indexOfItem]
                    
                self?.showSystemActionSheet(for: pkg)
                break
            }
        }
    }
}

func showSystemActionSheet() {

    Purchases.shared.buy(package deal: package deal) { (transaction, customerInfo, error, userCancelled) in

        if let error = error as? RevenueCat.ErrorCode {
            swap error {
            case .purchaseCancelledError: // *** utilizing breakpoints this will get hit once I cancel or dismiss the actionSheet
                return
            case .productAlreadyPurchasedError, .operationAlreadyInProgressForProductError, .receiptInUseByOtherSubscriberError :
                print("buy is lively")
            case .purchaseNotAllowedError:
                print("purchases_not_allowed")
            case .purchaseInvalidError:
                print("invalid_purchase_check_payment_method")
            default: break
            }
            return
        }

        if userCancelled {
            return 
        }

        guard let customerInfo = customerInfo else { 
            return 
        }

        // this could get hit but it surely by no means does
        // person pressed Subscribe then pressed the OK button from the You are All Set alert
    }
}

enter image description here

enter image description here

Related Articles

Social Media Auto Publish Powered By : XYZScripts.com