Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Objective-C PHP
Branch: master
Pull request Compare This branch is 7 commits ahead of zomfg:master.

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
Server Code



Version X

brief list of changes

  • improved "remote product server" mode
  • rewritten classes
  • switchable network adapters
  • switchable data source for products
  • more flexible configuration
  • some renaming / typo corrections
  • less memory leaks
  • updated server sample code

Rewritten classes

All the network code in MKSKProduct and MKSKSubscriptionProduct was moved in separate classes (see network adapters section)

Network Adapters

You can now use different networking code that suits your needs. 2 adapters are currently available:

  • MKSKRequestAdapterNSURLConnection (default adapter) if you don't use any particular networking library in your project it'll do the job
  • MKSKRequestAdapterRestKit is way more reliable than the default one, if you use RestKit in your project go for this one

You can write and use your own:

  • implement MKSKRequestAdapterProtocol
  • add it in MKSKRequestAdapter.h
  • #define it in MKStoreKitConfigs.h

Product Data Source

You can now define your own data source for the products (plist, core data, remote...):

  • implement MKStoreManagerDataSource protocol
  • pass your data source object to the store at initilization

    [MKStoreManager sharedManager].dataSource = [YourProductDataSource new];

Plist data source example is bundled in the project (based on the plist configuration of the previous versions).

New Configuration

It's still in MKStoreKitConfigs.h, you can change everything directly in this file or leave it and #define what you need in your .pch file for ex.

New Usage

It didn't change a lot, but it's more rebust and flexbile


[MKStoreManager sharedManager].dataSource = [YourProductDataSource new];
[[MKStoreManager sharedManager] launch];


[[MKStoreManager sharedManager] buyFeature:YOUR_PRODUCT_ID 
            onComplete:^(id response) 
                // Everything is OK
                // show some confirmation
                // update your UI...
            onCancel:^(NSError* error)
                // handle the error
            onError:^(NSError* error) 
                    // Handle StoreKit errors
                    if ([[error domain] isEqualToString:SKErrorDomain]) {
                        switch ([error code]) {
                            case SKErrorPaymentNotAllowed://user is not allowed to authorize payments
                            case SKErrorClientInvalid://client is not allowed to perform the attempted action
                            case SKErrorPaymentInvalid://payment parameters was not recognized by the Apple App Store
                            case SKErrorPaymentCancelled://user cancelled a payment request
                            case SKErrorUnknown://also appears when the user cancels the login
                    } else {
                        //Handle all other errors    

This is version 4 of MKStoreKit

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

To purchase a feature, just call

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

It’s that simple with my MKStoreKit.

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.

What's new in Version 4

MKStoreKitDelegate removed in favour of Blocks Keychain support using SFHFKeychainUtils Basic support for ARC Full support for auto-renewable subscriptions The code is now iOS 4 only

What's new in Version 3.5

Support for Auto renewable subscriptions

  • MKStoreKit can automatically verify your subscriptions without requiring user to enter password Bug fix in consumable module

What's new in Version 3

Support for Server Product Model MKStoreKit can automatically post the receipt data to your server and "remember" the purchases only when your server returns. The server code for the same in PHP is also available within MKStoreKit

What's new in Version 2

In Version 2, support for pinging the developer server for checking review requests is added. If you want to use this feature, you have to fill in "ownServer" variable to the location where you copy the server file featureCheck.php

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

The URL which you should copy to "ownServer" variable in MKStoreManager.m is Copy this URL to ownServer parameter in MKStoreManager.m

It should all work. If it doesn't, hire me for debugging it! :)

Something went wrong with that request. Please try again.