Note that there are some explanatory texts on larger screens.

plurals
  1. POHandle cancelled IAP transactions
    primarykey
    data
    text
    <p>I'm using StoreKit for in-app purchases. I'm finding that the API is quirky in its behavior when the user presses the "Cancel" button.</p> <p>For example, if I push Cancel on the "Confirm Your In App Purchase" screen, I get a <code>SKPaymentTransactionStateFailed</code> transaction with <code>error.code == SKErrorPaymentCancelled</code> as I'd expect.</p> <p>But if I push Buy and then press Cancel, I get a <code>Failed</code> transaction with <code>error.code == 0</code>. The <code>error.localizedDescription</code> is "Cannot connect to iTunes Store" which is clearly a lie.</p> <p>It's tempting to treat all <code>Failed</code> transactions as ignorable cancellations, but I can also clearly see that if the device is offline in airplane mode, I get a <code>Failed</code> transaction with no alert popup; I should really notify the user to explain the problem in that case.</p> <p>I note that <a href="https://github.com/MugunthKumar/MKStoreKit">MKStoreKit</a> assumes all failures are cancellations. <code>MKStoreManager</code>'s <a href="https://github.com/MugunthKumar/MKStoreKit/blob/master/MKStoreObserver.m"><code>failedTransaction</code></a> method is never called; <code>MKStoreObserver</code> always calls <code>transactionCanceled</code> for all <code>Failed</code> transactions. The <code>MKStoreManager.h</code> comments <a href="https://github.com/MugunthKumar/MKStoreKit/blob/master/MKStoreManager.h#L53">recommend no error message</a> for <code>transactionCanceled</code>, which makes sense, but then who will notify the user about <code>Failed</code> non-cancelled transactions?</p> <p>What's the best practice for handling these failures? Should I swallow errors? Always show an error, even if it's redundant?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload