Guest User

MKStoreManager.h

a guest
Nov 27th, 2013
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #import <Foundation/Foundation.h>
  2. #import <StoreKit/StoreKit.h>
  3. #import "MKStoreObserver.h"
  4.  
  5. #import "MKStoreSetup.h"
  6.  
  7. @protocol MKStoreKitDelegate <NSObject>
  8. @optional
  9. - (void)productFetchComplete;
  10. - (void)productPurchased:(NSString *)productId;
  11. - (void)transactionCanceled;
  12. // as a matter of UX, don't show a "User Canceled transaction" alert view here
  13. // use this only to "enable/disable your UI or hide your activity indicator view etc.,
  14. @end
  15.  
  16. @interface MKStoreManager : NSObject<SKProductsRequestDelegate> {
  17.  
  18.   NSMutableDictionary* _catalog;
  19.   NSMutableData* _catalog_data;
  20.     NSMutableArray *_purchasableObjects;
  21.     MKStoreObserver *_storeObserver;
  22.    
  23.     BOOL isProductsAvailable;
  24. }
  25.  
  26. @property (nonatomic, retain) NSMutableDictionary* catalog;
  27. @property (nonatomic, retain) NSMutableArray *purchasableObjects;
  28. @property (nonatomic, retain) MKStoreObserver *storeObserver;
  29.  
  30. // These are the methods you will be using in your app
  31. + (MKStoreManager*)sharedManager;
  32.  
  33. // this is a static method, since it doesn't require the store manager to be initialized prior to calling
  34. + (BOOL) isFeaturePurchased:(NSString*) featureId;
  35.  
  36. - (SKProduct*) getSKProductByID:(NSString*) featureId;
  37.  
  38. // these three are not static methods, since you have to initialize the store with your product ids before calling this function
  39. - (void) buyFeature:(NSString*) featureId;
  40. - (NSMutableArray*) purchasableObjectsDescription;
  41. - (void) restorePreviousTransactions;
  42.  
  43. - (BOOL) canConsumeProduct:(NSString*) productIdentifier quantity:(int) quantity;
  44. - (BOOL) consumeProduct:(NSString*) productIdentifier quantity:(int) quantity;
  45.  
  46.  
  47. //DELEGATES
  48. +(id)delegate; 
  49. +(void)setDelegate:(id)newDelegate;
  50.  
  51. @end
Advertisement
Add Comment
Please, Sign In to add comment