Reputation: 31161
I'm declaring that my app delegate conforms to the protocols
<UIApplicationDelegate, SKPaymentTransactionObserver>
in the app delegate header file (i.e. the app delegate interface).
The compiler tells me at numerous places in my code that:
warning: type 'id <UIApplicationDelegate>' does not conform to the 'SKPaymentTransactionObserver' protocol
What's up?
Upvotes: 0
Views: 724
Reputation: 237080
You're probably doing something like [[SKPaymentQueue defaultQueue] addTransactionObserver:[[UIApplication sharedApplication] delegate]]
. Since -[UIApplication delegate]
is declared as returning id<UIApplicationDelegate>
, the compiler has no way of knowing that the object returned will implement the SKPaymentTransactionObserver protocol. Try assigning the delegate to a variable that's statically typed as your delegate class and pass that to the method you're trying to call and the compiler should be happy.
Upvotes: 2
Reputation: 50717
Your ApplicationDelegate seems to be missing some of the required delegates, for example:
- (void)applicationWillResignActive:(UIApplication *)application
Check what delegate methods SKPaymentTransactionObserver
requires, and add them to your AppDelegate.m
Also, check over the SKPaymentTransactionObserver Protocol Reference
Upvotes: -1