Skip to content

Successful purchase notification happening before verification completes #16

@Ghirigoro

Description

@Ghirigoro

The delegate methods for successful restores and purchases are invoked prior to verification completing. If verifications fail this leads to scenarios where ASTStoreController informs its delegate that an item has been successfully purchased but then the item results as not having been purchased when you query it.

As quick and dirty hack I changed the paymentQueueRestoreCompletedTransactionsFinished: method so that it it polls verifyingCount and waits until verifying count reaches zero before telling the delegate that the restore was completed (the modified code is listed below).

I haven't taken a look at the purchasing yet but if anyone has suggestions for a better solution to the issue please let me know.

  • (void)paymentQueueRestoreCompletedTransactionsFinished:(SKPaymentQueue *)queue
    {
    DLog(@"restore complete");
    self.restoringPurchases = NO;
    if( self.purchaseState == ASTStoreControllerPurchaseStateProcessingPayment )
    {
    // Could be verifying in the background - only update to none state if
    // last known state was processing. Since restoringPurchase flag has been
    // disabled, the finalize transation will deal with resetting state to none.
    self.purchaseState = ASTStoreControllerPurchaseStateNone;
    }

    static void (^restorePollBlock)() = nil;

    if (restorePollBlock == nil) {
    __block id b_self = self;
    __block void (^b_pollBlock)();
    restorePollBlock = [^];
    b_pollBlock = restorePollBlock;
    }

    restorePollBlock();
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions