Permalink
Browse files

Going gold

  • Loading branch information...
1 parent 7e25cdb commit e6b1dabfcb0275b0ca1490fce892db02b2520710 @MugunthKumar MugunthKumar committed Jul 8, 2011
Showing with 18 additions and 4 deletions.
  1. +4 −2 MKStoreKitConfigs.h
  2. +2 −0 MKStoreManager.h
  3. +12 −2 MKStoreManager.m
View
@@ -39,9 +39,11 @@
#define kConsumableBaseFeatureId @"com.mycompany.myapp."
#define kFeatureAId @"com.mugunthkumar.subinapptest.wk1"
#define kConsumableFeatureBId @"com.mycompany.myapp.005"
-
-#define kSharedSecret @"749a1ca3750a421fa92cf8e139a6f539"
+#define FishBasket @"FishBasket"
#define SERVER_PRODUCT_MODEL 0
#define OWN_SERVER nil
#define REVIEW_ALLOWED 1
+
+#warning Shared Secret Missing Ignore this warning if you don't use auto-renewable subscriptions
+#define kSharedSecret @"<FILL IN YOUR SHARED SECRET HERE>"
View
@@ -48,6 +48,8 @@
#endif
#define kProductFetchedNotification @"MKStoreKitProductsFetched"
+#define kSubscriptionsPurchasedNotification @"MKStoreKitSubscriptionsPurchased"
+#define kSubscriptionsInvalidNotification @"MKStoreKitSubscriptionsInvalid"
@interface MKStoreManager : NSObject<SKProductsRequestDelegate>
View
@@ -417,7 +417,7 @@ - (void) startVerifyingSubscriptionReceipts
self.subscriptionProducts = [NSMutableDictionary dictionary];
for(NSString *productId in [subscriptions allKeys])
{
- MKSKSubscriptionProduct *product = [[[MKSKSubscriptionProduct alloc] initWithProductId:productId subscriptionDays:[[subscriptionProducts objectForKey:productId] intValue]] autorelease];
+ MKSKSubscriptionProduct *product = [[[MKSKSubscriptionProduct alloc] initWithProductId:productId subscriptionDays:[[subscriptions objectForKey:productId] intValue]] autorelease];
product.receipt = [MKStoreManager dataForKey:productId]; // cached receipt
if(product.receipt)
@@ -426,12 +426,19 @@ - (void) startVerifyingSubscriptionReceipts
{
if([isActive boolValue] == NO)
{
+ [[NSNotificationCenter defaultCenter] postNotificationName:kSubscriptionsInvalidNotification
+ object:product.productId];
+
NSLog(@"Subscription: %@ is inactive", product.productId);
}
+ else
+ {
+ NSLog(@"Subscription: %@ is active", product.productId);
+ }
}
onError:^(NSError* error)
{
-
+ NSLog(@"Unable to check for subscription validity right now");
}];
}
@@ -450,6 +457,9 @@ -(void) provideContent: (NSString*) productIdentifier
subscriptionProduct.receipt = receiptData;
[subscriptionProduct verifyReceiptOnComplete:^(NSNumber* isActive)
{
+ [[NSNotificationCenter defaultCenter] postNotificationName:kSubscriptionsPurchasedNotification
+ object:productIdentifier];
+
[MKStoreManager setObject:receiptData forKey:productIdentifier];
}
onError:^(NSError* error)

0 comments on commit e6b1dab

Please sign in to comment.