Perhaps you are installing the wrong transaction observer (or not installing it) in one of the two controllers mentioned.
To receive notifications when a transaction is updated, you must add an observer as follows:
[[SKPaymentQueue defaultQueue] addTransactionObserver:something];
where something can be self (if your paymentQueue:updatedTransactions: method is on self ) or another object.
If you put the appropriate code for the two controllers (controller names and calls to the addTransactionObserver: method mentioned above, plus a little context), I can give you more information, but before that I can make some assumptions.
Suppose you have two controllers:
UserOnboardingController
UpgradeController
You say that it works correctly in the UpgradeController , this is probably due to the fact that when loading the controller (for example, in viewDidLoad: there is a call
[[SKPaymentQueue defaultQueue] addTransactionObserver:self];
and paymentQueue:updatedTransactions: is one of the UpgradeController methods.
However, when you are on the UserOnboardingController , you are not calling or passing the wrong observer to the addTransactionObserver: method.
If so, you should:
- get the correct observer from the ViewController hierarchy and pass it as an observer
- move transaction observer code to a common class (for example, in
AppDelegate or another specific singleton class)
source share