I have InApp purchasing setup in my app. I am having some weird behavior though. Each time I start up the app I call
[[SKPaymentQueue defaultQueue] addTransactionObserver:self];
to setup the initial observer. However this immediately triggers
- (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions
with a full array of every transaction. I have tried just calling
[[SKPaymentQueue defaultQueue] finishTransaction: transaction];
on each of these transaction then restarting the app again but paymentQueue is still trigger as soon as I call addTransactionObserver. My main goal right now is just to flush the transaction queue and start clean. I don't know how I got into this state, nor how to get out of it.
Restart the device Tap Power off or Restart (depending on your device this text may be different). If needed, hold down the power button again to turn the device back on. Wait for the device to start back up. Re-open the app or game and check if the in-app purchase has been delivered.
Your Apple ID may be linked with too many credit cards. Your credit card may be blocked. You're trying to buy something which is not allowed by Apple in your country. You know how some apps or content may not be available or might be banned from certain countries?
Make sure that you're signed in with the same Apple ID that you used to make the purchase. Make sure that in-app purchases are allowed on your device. Restart your device: Restart your iPhone.
Prevent Accidental In-App Purchases on AndroidIn the Store's top-right corner, tap your profile icon. In the profile menu, tap “Settings.” On the “Settings” page, select “Authentication.” In the expanded “Authentication” menu, tap “Require Authentication for Purchases.”
From SKPaymentTransactionObserver:PaymentQueue..
call:
SKPaymentQueue.default().finishTransaction(transaction)
Note that you can not call for all types. Calling finishTransaction
for .purchasing
will crash with error. So a for
through all transactions is not a complete solution.
When you Call finishTransaction
for .purchasing
:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Cannot finish a purchasing transaction'
Make sure you have implemented this method:
-(void)paymentQueue:(SKPaymentQueue *)queue removedTransactions:(NSArray *)transactions;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With