add(_:)
Adds an observer to the payment queue.
Declaration
func add(_ observer: any SKPaymentTransactionObserver)Parameters
- observer:
The observer to add to the queue.
Mentioned in
Discussion
Your application should add an observer to the payment queue during application initialization. If there are no observers attached to the queue, the payment queue does not synchronize its list of pending transactions with the Apple App Store, because there is no observer to respond to updated transactions.
If an application quits when transactions are still being processed, those transactions are not lost. The next time the application launches, the payment queue resumes processing the transactions. Your application should always expect to be notified of completed transactions.
If more than one transaction observer is attached to the payment queue, no guarantees are made as to the order which they will be called. It is safe for multiple observers to call finishTransaction(_:), but not recommended. It is recommended that you use a single observer to process and finish the transaction.