IAPManager icon indicating copy to clipboard operation
IAPManager copied to clipboard

Handling Restore calls without having purchases anything

Open ghost opened this issue 9 years ago • 0 comments

If a user restores and hasn't purchased anything before IAPManager calls the restoreCompletionBlock. Which I think is the wrong UX

This case is not handled by -(void)paymentQueue:(SKPaymentQueue *)queue restoreCompletedTransactionsFailedWithError:(NSError *)error because "error" is a transaction error to the Apple servers, but not a empty SKPaymentQueue (as I thought before. lol)

A modified - (void)paymentQueueRestoreCompletedTransactionsFinished:(SKPaymentQueue *)queue fixes it.

- (void)paymentQueueRestoreCompletedTransactionsFinished:(SKPaymentQueue *)queue {

    if (!queue.transactions || [queue.transactions count] == 0) {
        if(self.restoreErrorBlock) {

            self.restoreErrorBlock(0);
        }


    } else if (self.restoreCompletionBlock) {
            self.restoreCompletionBlock();
        }


    self.restoreCompletionBlock = nil;
    self.restoreErrorBlock = nil;
}

ghost avatar Mar 25 '15 14:03 ghost