Permalink
Browse files

Do not make two different receipts for nonconsumables; this mimics "W…

…ould you like to redownload again?" behavior for the real StoreKit.
  • Loading branch information...
1 parent 98fa4bb commit 85913ee0e56f1c2ad37b0941370ee5e5a65a9b9c @millenomi committed Feb 3, 2010
Showing with 14 additions and 2 deletions.
  1. +14 −2 ILSimSKPaymentQueue.m
View
@@ -180,8 +180,20 @@ - (void) succeed;
if (!a)
a = [NSMutableArray array];
- [a addObject:r];
- [[NSUserDefaults standardUserDefaults] setObject:a forKey:@"ILSimSKTransactions"];
+ BOOL shouldAdd = YES;
+ if (p.simulatedProductType == kILSimSimulatedProductTypeNonConsumable) {
+ for (NSDictionary* receipt in a) {
+ if ([[receipt objectForKey:@"ProductID"] isEqual:p.productIdentifier]) {
+ shouldAdd = NO;
+ break;
+ }
+ }
+ }
+
+ if (shouldAdd) {
+ [a addObject:r];
+ [[NSUserDefaults standardUserDefaults] setObject:a forKey:@"ILSimSKTransactions"];
+ }
[self performSelector:@selector(signalFinished) withObject:nil afterDelay:2.0];
}

0 comments on commit 85913ee

Please sign in to comment.