Skip to content

troya2/MKStoreKit

 
 

Repository files navigation

#MKStoreKit

This is version 4.3.1 of MKStoreKit.

Changed config process so files in revision control don't have to be changed for each app. In particular, removed MKStoreKitConfgs.h and allow you to specify the name of the items plist file that specifies what items you sell. Also fixed several compiler warnings and the code that handles server-side validation results.

Added a setup method that you should call from your app delegate that sets all the user-configurable settings.

      [MKStoreManager setupWithSharedSecret:@"your-shared-secret" 
                                     server:@"https://Your.server.com" // or nil if you don't do server-side receipt validations 
                              reviewAllowed:YES                        // see below regarding temporary free access to reviewers
                                 itemsPlist:@"StoreKitItems.plist"];   // name of the plist file specifying your sellable items

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 setupWithSharedSecret:server:reviewAllowed:itemsPlist:] in your applicationDidFinishLaunching. From then on, it does the magic. The MKStoreKit automatically activates/deactivates features using the keychain. When a feature is purchased, it automagically records it into the keychain. 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

Packages

No packages published

Languages

  • Objective-C 98.8%
  • PHP 1.2%