Question

Promoted IAP implementation - readyForPromotedProduct does not get called

  • 4 July 2023
  • 3 replies
  • 204 views

Badge +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

Userlevel 4
Badge +6

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? 

Badge +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

Userlevel 4
Badge +6

Hey @Aleksandar Draskovic ,

 

We have a couple of test use cases in our sample apps which use the delegate. I went ahead and linked them below:

 

Let me know if that helps! 

Reply