8

In my In App purchase the case SKPaymentTransactionStateRestored: method does not get called when the purchase is restored, instead, case SKPaymentTransactionStatePurchased: is being called, but would like to show the user different information, when the purchase is restored.

JonasG
  • 9,274
  • 12
  • 59
  • 88
  • Having same issue.. did you get any answer ? – k-thorat Aug 03 '11 at 00:02
  • @TheAstra no i still have not found a solution. I will maybe ask in the Apple Dev forums – JonasG Aug 03 '11 at 05:43
  • no.... But i haven't asked in the apple dev forums yet. I would recommend doing this, I am not very interested in this problem right now, i have other bigger problems to solve :P! – JonasG Sep 22 '11 at 16:42

4 Answers4

3

[queue restoreCompletedTransactions] will trigger SKPaymentTransactionStateRestored state, where queue is SKPaymentQueue. You should not expect this to be called after your user confirms transactions. Instead user would be warned by the device if he had already purchased the product.

Bora
  • 417
  • 3
  • 15
0

You can implement paymentQueueRestoreCompletedTransactionsFinished: to determine if a restore was finished:

http://developer.apple.com/library/ios/#documentation/StoreKit/Reference/SKPaymentTransactionObserver_Protocol/Reference/Reference.html

robodo
  • 430
  • 3
  • 8
0

In case, it's not solved yet, you might do it with a logical trick. When the restore is beeing triggered, remember it with a boolean flag (or a enum state, if you prefer) and show a different message when the SKPaymentTransactionStatePurchased is beeing triggered. You might implement the two delegate methods

- (void)paymentQueueRestoreCompletedTransactionsFinished:(SKPaymentQueue *)queue

and

- (void)paymentQueue:(SKPaymentQueue *)queue restoreCompletedTransactionsFailedWithError:(NSError *)error

to find out, when the restore has been finished. And to be save in this case, you might not let the user make any purchases, while the restore is in progress. You could show the user something like this, so the user sees, that something is currently happening.

This is what i did and it works for me.

Community
  • 1
  • 1
NicTesla
  • 1,626
  • 5
  • 21
  • 35
0

I've a clue. The method (paymentqueue:updatedTransactions:) and especcially the SKPaymentTransactionStateRestored: state is getting called, when i create a SKProductRequest and start loading it.

SKProductsRequest *request = [[SKProductsRequest alloc] initWithProductIdentifiers: [NSSet setWithArray: productIdentifiers]];
        request.delegate = self; 
        [request start];

I'll have a look on Apples solution and see, if i can find any differences.

NicTesla
  • 1,626
  • 5
  • 21
  • 35