delegate does not respond to method paymentQueue:shouldAddStorePayment:forProduct

Hi,


I need use the method paymentQueue:shouldAddStorePayment:forProduct for buy from Appstore. But I open the application with this link, I receive a message in console:


Tried to send purchase intent: <productID> to delegate, delegate does not respond to method paymentQueue:shouldAddStorePayment:forProduct


This is the link:


itms-services://?action=purchaseIntent&bundleId=<bundleID>&productIdentifier=<productID>


Docs:


https://developer.apple.com/documentation/storekit/in-app_purchase/testing_promoted_in-app_purchases


https://developer.apple.com/documentation/storekit/skpaymenttransactionobserver/2877502-paymentqueue?language=objc


My code:


AppDelegate.h


#import <StoreKit/StoreKit.h>

@interface AppDelegate : CDVAppDelegate <SKPaymentTransactionObserver, SKPaymentQueueDelegate> {}

@end


AppDelegate.m

@implementation AppDelegate

- (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions
{
    return [super application:application didFinishLaunchingWithOptions:launchOptions];
}

- (BOOL)paymentQueue:(SKPaymentQueue *)queue shouldAddStorePayment:(SKPayment *)payment forProduct:(SKProduct *)product
{
    return true;//Never is executed
}


Thanks

I am not familiar with this new method but I'm pretty sure you need to add a transaction observer to get a call back to the delegate.

https://developer.apple.com/documentation/storekit/in-app_purchase/setting_up_the_transaction_observer_for_the_payment_queue?language=objc

Smells like a unity problem, off-topic for devForums, BTW.


See h ttps://forum.unity.com/threads/solved-promoted-iap-not-working-as-desired.508763/


Good luck.

Try:


- (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions  
{  


    [[SKPaymentQueue defaultQueue] addTransactionObserver:self];
    return [super application:application didFinishLaunchingWithOptions:launchOptions];  
}



Are you using Unity?

delegate does not respond to method paymentQueue:shouldAddStorePayment:forProduct
 
 
Q