-
Notifications
You must be signed in to change notification settings - Fork 13
Description
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();
}