Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 85 lines (69 sloc) 3.591 kb
5cff421 @MugunthKumar Initial commit of Version 3.1
authored
1 //
24e9634 @MugunthKumar Bug fixes and version updated to 4.3
authored
2 // MKStoreManager.h
3 // MKStoreKit (Version 4.2)
5cff421 @MugunthKumar Initial commit of Version 3.1
authored
4 //
5 // Created by Mugunth Kumar on 17-Nov-2010.
6 // Copyright 2010 Steinlogic. All rights reserved.
7 // File created using Singleton XCode Template by Mugunth Kumar (http://mugunthkumar.com
8 // Permission granted to do anything, commercial/non-commercial with this file apart from removing the line/URL above
9 // Read my blog post at http://mk.sg/1m on how to use this code
10
7e25cdb @MugunthKumar Huge cleanup of Code bloat
authored
11 // Licensing (Zlib)
12 // This software is provided 'as-is', without any express or implied
13 // warranty. In no event will the authors be held liable for any damages
14 // arising from the use of this software.
15 //
16 // Permission is granted to anyone to use this software for any purpose,
17 // including commercial applications, and to alter it and redistribute it
18 // freely, subject to the following restrictions:
19 //
20 // 1. The origin of this software must not be misrepresented; you must not
21 // claim that you wrote the original software. If you use this software
22 // in a product, an acknowledgment in the product documentation would be
23 // appreciated but is not required.
24 // 2. Altered source versions must be plainly marked as such, and must not be
25 // misrepresented as being the original software.
26 // 3. This notice may not be removed or altered from any source distribution.
27
5cff421 @MugunthKumar Initial commit of Version 3.1
authored
28 // As a side note on using this code, you might consider giving some credit to me by
29 // 1) linking my website from your app's website
30 // 2) or crediting me inside the app's credits page
31 // 3) or a tweet mentioning @mugunthkumar
32 // 4) A paypal donation to mugunth.kumar@gmail.com
33
34
35 #import <Foundation/Foundation.h>
36 #import <StoreKit/StoreKit.h>
37 #import "MKStoreObserver.h"
1cff559 @MugunthKumar Version 4 changes
authored
38 #import "MKStoreKitConfigs.h"
97b0823 @MugunthKumar Added SubscriptionProduct class
authored
39 #import "JSONKit.h"
5e193aa @MugunthKumar Added Support for Auto renewable subscriptions
authored
40
41 #define kReceiptStringKey @"MK_STOREKIT_RECEIPTS_STRING"
42
43 #ifndef NDEBUG
1cff559 @MugunthKumar Version 4 changes
authored
44 #define kReceiptValidationURL @"https://sandbox.itunes.apple.com/verifyReceipt"
5e193aa @MugunthKumar Added Support for Auto renewable subscriptions
authored
45 #else
1cff559 @MugunthKumar Version 4 changes
authored
46 #define kReceiptValidationURL @"https://buy.itunes.apple.com/verifyReceipt"
5e193aa @MugunthKumar Added Support for Auto renewable subscriptions
authored
47 #endif
48
1cff559 @MugunthKumar Version 4 changes
authored
49 #define kProductFetchedNotification @"MKStoreKitProductsFetched"
e6b1dab @MugunthKumar Going gold
authored
50 #define kSubscriptionsPurchasedNotification @"MKStoreKitSubscriptionsPurchased"
51 #define kSubscriptionsInvalidNotification @"MKStoreKitSubscriptionsInvalid"
5cff421 @MugunthKumar Initial commit of Version 3.1
authored
52
1cff559 @MugunthKumar Version 4 changes
authored
53 @interface MKStoreManager : NSObject<SKProductsRequestDelegate>
5cff421 @MugunthKumar Initial commit of Version 3.1
authored
54
55 // These are the methods you will be using in your app
56 + (MKStoreManager*)sharedManager;
57
58 // this is a static method, since it doesn't require the store manager to be initialized prior to calling
59 + (BOOL) isFeaturePurchased:(NSString*) featureId;
a9538d5 @bobbypage added prices dictionary
bobbypage authored
60 //returns a dictionary with all prices for identifiers
61 - (NSMutableDictionary *)pricesDictionary;
5cff421 @MugunthKumar Initial commit of Version 3.1
authored
62 - (NSMutableArray*) purchasableObjectsDescription;
1cff559 @MugunthKumar Version 4 changes
authored
63
64 // use this method to invoke a purchase
65 - (void) buyFeature:(NSString*) featureId
66 onComplete:(void (^)(NSString*)) completionBlock
67 onCancelled:(void (^)(void)) cancelBlock;
68
69 // use this method to restore a purchase
70 - (void) restorePreviousTransactionsOnComplete:(void (^)(void)) completionBlock
71 onError:(void (^)(NSError*)) errorBlock;
72
7e25cdb @MugunthKumar Huge cleanup of Code bloat
authored
73 - (BOOL) canConsumeProduct:(NSString*) productName quantity:(int) quantity;
74 - (BOOL) consumeProduct:(NSString*) productName quantity:(int) quantity;
97b0823 @MugunthKumar Added SubscriptionProduct class
authored
75 - (BOOL) isSubscriptionActive:(NSString*) featureId;
f8b74d3 @bobbypage added ability to remove all saved keychain data
bobbypage authored
76 //for testing proposes you can use this method to remove all the saved keychain data (saved purchases, etc.)
77 - (BOOL) removeAllKeychainData;
5cff421 @MugunthKumar Initial commit of Version 3.1
authored
78
97b0823 @MugunthKumar Added SubscriptionProduct class
authored
79 +(void) setObject:(id) object forKey:(NSString*) key;
80 +(NSNumber*) numberForKey:(NSString*) key;
7e25cdb @MugunthKumar Huge cleanup of Code bloat
authored
81
1cff559 @MugunthKumar Version 4 changes
authored
82 -(void) restoreCompleted;
83 -(void) restoreFailedWithError:(NSError*) error;
5cff421 @MugunthKumar Initial commit of Version 3.1
authored
84 @end
Something went wrong with that request. Please try again.