Skip to content

N0ah/MKStoreKit

 
 

Repository files navigation

#MKStoreKit

This is version 4.3 of MKStoreKit. Few minor bugs reported in auto renewable subscriptions

I'm working on supporting Lion. Not sure if the current version already works. (I guess it should). Once this is done, I guess, MKStoreKit will not have any more major updates (till Apple introduces new IAP mechanisms).

Read the blog post for more.

The source code, MKStoreKit, contains several new objective c files notably MKStoreKitConfigs.h among others like, MKStoreManager.h/m and MKStoreObserver.h/m and five server side files. The MKStoreManager is a singleton class that takes care of everything. Just include StoreKit.Framework and Security.Framework into your product and drag these four files into the project. You then have to initialize it by calling [MKStoreManager sharedManager] in your applicationDidFinishLaunching. From then on, it does the magic. The MKStoreKit automatically activates/deactivates features using your userDefaults. When a feature is purchased, it automagically records it into NSUserDefaults. For checking whether the user has purchased the feature, you can call a function like,

if([MKStoreManager isFeaturePurchased:kFeatureID])
{
//unlock it
}
if([MKStoreManager isSubscriptionActive:kFeatureID])
{
//unlock it
}

To purchase a feature, just call

[[MKStoreManager sharedManager] buyFeature:kFeatureAId 
                                onComplete:^(NSString* purchasedFeature)
 {
     NSLog(@"Purchased: %@", purchasedFeature);
 }
                               onCancelled:^
 {
     NSLog(@"User Cancelled Transaction");
 }];

It’s that simple with my MKStoreKit.

License

MKStoreKit uses zLib licensing And so all of my source code can be used royalty-free into your app. Just make sure that you don’t remove the copyright notice from the source code if you make your app open source. You don’t have to attribute me in your app, although I would be glad if you do so.

Server Side

The database required can be created from the sql file attached.

The code that you need for setting up your server is present in the ServerCode folder.

Copy all the files to some location like http://api.mycompany.com/inapp/

The URL which you should copy to "ownServer" variable in MKStoreManager.m is http://api.mycompany.com/inapp/featureCheck.php Copy this URL to ownServer parameter in MKStoreManager.m