Skip to content

chrisvasselli/MKStoreKit

 
 

Repository files navigation

#MKStoreKit

This is version 5 of MKStoreKit. iOS 5+ only and requires zeroing weak referencing environment. No support for non-ARC compilers. MKStoreKit 5 is not API compatible with MKStoreKit 4. Dont' expect it to work out of the box if you are updating from a previous version. Refactoring should however be a simple 5 minute work. I'm working on In App Purchase hosted content support on iOS 6. It's implemented, but for some apparent reason, download doesn't happen. I've raised a support ticket to Apple.

JSONKit is removed in favour of NSJSONSerialization (Removes 20+ warnings)

The MKStoreObserver class is removed as a part of refactoring. MKStoreKit 5 is the leanest release ever after 1.0

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, 
                                             NSData* purchasedReceipt, 
                                             NSArray* availableDownloads)
 {
     NSLog(@"Purchased: %@", purchasedFeature);
 }
                               onCancelled:^
 {
     NSLog(@"User Cancelled Transaction");
 }];

It’s that simple with my MKStoreKit.

License

MKStoreKit uses MIT 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 and in the about page.

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