Skip to main content
Question

Promoted IAP implementation - readyForPromotedProduct does not get called


Forum|alt.badge.img+1

Dear all,

I am trying to implement promoted IAPs feature by using PurchasesDelegate. I have the latest iOS SDK installed.
 

Whenever I use the test link as described here: https://developer.apple.com/documentation/storekit/in-app_purchase/testing_promoted_in-app_purchases, nothing happens in the delegate method, and all I receive from the console is this:

[Daemon] [SKPaymentQueue]: Tried to send purchase intent: pretty.ios.avatarai.monthly to delegate, delegate does not respond to method paymentQueue:shouldAddStorePayment:forProduct

Delegate method being used is:

func purchases(_ purchases: Purchases,

                                  readyForPromotedProduct product: StoreProduct,

                   purchase startPurchase: @escaping StartPurchaseBlock) {

        startPurchase { (transaction, info, cancelled, error)  in

        }

    }


Can anyone give me a hint what I am doing wrong? 

Implementation with previous versions of SDK were working, with old delegate methods.

Aleksandar

3 replies

Michael Fogel
Forum|alt.badge.img+6
  • Dedicated Contributor
  • 382 replies
  • July 10, 2023

Hey @Aleksandar Draskovic ,

 

You will want to call that when a user initiates a promotional in-app purchase from the App Store. If your app is able to handle a purchase at the current time, run the deferment block in this method. If the app is not in a state to make a purchase: cache the startPurchase block, then call the startPurchase block when the app is ready to make the promotional purchase. 

 

In this case, should the app be able to handle a purchase for this promoted product at the time when it is called? 


Forum|alt.badge.img+1

Hey @Michael Fogel ,

The problem is that delegate method which contains deferment block does not get called ever. I know what I need to do, but the delegate method isn’t being called at all. I mentioned this in the description of my post.

We are talking about PurchasesDelegate.

The delegate has three methods:

  1. optional func purchases(_ purchases: Purchases, receivedUpdated customerInfo: CustomerInfo)
  2. @objc optional func purchases(_ purchases: Purchases,

                                      readyForPromotedProduct product: StoreProduct,

                                      purchase startPurchase: @escaping StartPurchaseBlock)

  3. @objc optional func purchases(_ purchases: Purchases,

                                      shouldPurchasePromoProduct product: StoreProduct,

                                      defermentBlock makeDeferredPurchase: @escaping StartPurchaseBlock)

The first one is getting called regularly. Second and third one are not responding. 

What can I do to make it respond to me? Is there any working example you can share?

Thank you for the effort.

Kind regards,

Aleksandar


Michael Fogel
Forum|alt.badge.img+6
  • Dedicated Contributor
  • 382 replies
  • July 12, 2023

Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings