diff --git a/MKStoreKit.m b/MKStoreKit.m deleted file mode 100644 index a39c591..0000000 --- a/MKStoreKit.m +++ /dev/null @@ -1,481 +0,0 @@ -// -// MKStoreKit.m -// MKStoreKit 6.0 -// -// Copyright 2014 Steinlogic Consulting and Training Pte Ltd. All rights reserved. -// File created using Singleton Xcode Template by Mugunth Kumar (http://blog.mugunthkumar.com) -// More information about this template on the post http://mk.sg/89 -// Permission granted to do anything, commercial/non-commercial with this file apart from removing the line/URL above -// Created by Mugunth Kumar (@mugunthkumar) on 17 Nov 2014. -// Copyright (C) 2011-2020 by Steinlogic Consulting And Training Pte Ltd. - -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -// As a side note on using this code, you might consider giving some credit to me by -// 1) linking my website from your app's website -// 2) or crediting me inside the app's credits page -// 3) or a tweet mentioning @mugunthkumar -// 4) A paypal donation to mugunth.kumar@gmail.com -// -// A note on redistribution -// if you are re-publishing after editing, please retain the above copyright notices - -#import "MKStoreKit.h" - -@import StoreKit; -NSString *const kMKStoreKitProductsAvailableNotification = @"com.mugunthkumar.mkstorekit.productsavailable"; -NSString *const kMKStoreKitProductPurchasedNotification = @"com.mugunthkumar.mkstorekit.productspurchased"; -NSString *const kMKStoreKitProductPurchaseFailedNotification = @"com.mugunthkumar.mkstorekit.productspurchasefailed"; -NSString *const kMKStoreKitProductPurchaseDeferredNotification = @"com.mugunthkumar.mkstorekit.productspurchasedeferred"; -NSString *const kMKStoreKitRestoredPurchasesNotification = @"com.mugunthkumar.mkstorekit.restoredpurchases"; -NSString *const kMKStoreKitRestoringPurchasesFailedNotification = @"com.mugunthkumar.mkstorekit.failedrestoringpurchases"; -NSString *const kMKStoreKitReceiptValidationFailedNotification = @"com.mugunthkumar.mkstorekit.failedvalidatingreceipts"; -NSString *const kMKStoreKitSubscriptionExpiredNotification = @"com.mugunthkumar.mkstorekit.subscriptionexpired"; - -NSString *const kSandboxServer = @"https://sandbox.itunes.apple.com/verifyReceipt"; -NSString *const kLiveServer = @"https://buy.itunes.apple.com/verifyReceipt"; - -NSString *const kOriginalAppVersionKey = @"SKOrigBundleRef"; // Obfuscating record key name - -static NSDictionary *errorDictionary; - -@interface MKStoreKit (/*Private Methods*/) -@property NSMutableDictionary *purchaseRecord; -@end - -@implementation MKStoreKit - -#pragma mark - -#pragma mark Singleton Methods - -+ (MKStoreKit *)sharedKit { - static MKStoreKit *_sharedKit; - if (!_sharedKit) { - static dispatch_once_t oncePredicate; - dispatch_once(&oncePredicate, ^{ - _sharedKit = [[super allocWithZone:nil] init]; - [[SKPaymentQueue defaultQueue] addTransactionObserver:_sharedKit]; - [_sharedKit restorePurchaseRecord]; -#if TARGET_OS_IPHONE - [[NSNotificationCenter defaultCenter] addObserver:_sharedKit - selector:@selector(savePurchaseRecord) - name:UIApplicationDidEnterBackgroundNotification object:nil]; -#elif TARGET_OS_MAC - [[NSNotificationCenter defaultCenter] addObserver:_sharedKit - selector:@selector(savePurchaseRecord) - name:NSApplicationDidResignActiveNotification object:nil]; -#endif - - [_sharedKit startValidatingReceiptsAndUpdateLocalStore]; - }); - } - - return _sharedKit; -} - -+ (id)allocWithZone:(NSZone *)zone { - return [self sharedKit]; -} - -- (id)copyWithZone:(NSZone *)zone { - return self; -} - -#pragma mark - -#pragma mark Initializer - -+ (void)initialize { - errorDictionary = @{@(21000) : @"The App Store could not read the JSON object you provided.", - @(21002) : @"The data in the receipt-data property was malformed or missing.", - @(21003) : @"The receipt could not be authenticated.", - @(21004) : @"The shared secret you provided does not match the shared secret on file for your accunt.", - @(21005) : @"The receipt server is not currently available.", - @(21006) : @"This receipt is valid but the subscription has expired.", - @(21007) : @"This receipt is from the test environment.", - @(21008) : @"This receipt is from the production environment."}; -} - -#pragma mark - -#pragma mark Helpers - -+ (NSDictionary *)configs { - return [NSDictionary dictionaryWithContentsOfFile:[[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"MKStoreKitConfigs.plist"]]; -} - - -#pragma mark - -#pragma mark Store File Management - -- (NSString *)purchaseRecordFilePath { - NSString *documentDirectory = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES).firstObject; - return [documentDirectory stringByAppendingPathComponent:@"purchaserecord.plist"]; -} - -- (void)restorePurchaseRecord { - self.purchaseRecord = (NSMutableDictionary *)[[NSKeyedUnarchiver unarchiveObjectWithFile:[self purchaseRecordFilePath]] mutableCopy]; - if (self.purchaseRecord == nil) { - self.purchaseRecord = [NSMutableDictionary dictionary]; - } -} - -- (void)savePurchaseRecord { - NSError *error = nil; - NSData *data = [NSKeyedArchiver archivedDataWithRootObject:self.purchaseRecord]; -#if TARGET_OS_IPHONE - BOOL success = [data writeToFile:[self purchaseRecordFilePath] options:NSDataWritingAtomic | NSDataWritingFileProtectionComplete error:&error]; -#elif TARGET_OS_MAC - BOOL success = [data writeToFile:[self purchaseRecordFilePath] options:NSDataWritingAtomic error:&error]; -#endif - - if (!success) { - NSLog(@"Failed to remember data record"); - } - - NSLog(@"%@", self.purchaseRecord); -} - -#pragma mark - -#pragma mark Feature Management - -- (BOOL)isProductPurchased:(NSString *)productId { - return [self.purchaseRecord.allKeys containsObject:productId]; -} - --(NSDate*) expiryDateForProduct:(NSString*) productId { - - NSNumber *expiresDateMs = self.purchaseRecord[productId]; - return [NSDate dateWithTimeIntervalSince1970:[expiresDateMs doubleValue] / 1000.0f]; -} - -- (NSNumber *)availableCreditsForConsumable:(NSString *)consumableId { - return self.purchaseRecord[consumableId]; -} - -- (NSNumber *)consumeCredits:(NSNumber *)creditCountToConsume identifiedByConsumableIdentifier:(NSString *)consumableId { - NSNumber *currentConsumableCount = self.purchaseRecord[consumableId]; - currentConsumableCount = @([currentConsumableCount doubleValue] - [creditCountToConsume doubleValue]); - self.purchaseRecord[consumableId] = currentConsumableCount; - [self savePurchaseRecord]; - return currentConsumableCount; -} - -- (void)setDefaultCredits:(NSNumber *)creditCount forConsumableIdentifier:(NSString *)consumableId { - if (self.purchaseRecord[consumableId] == nil) { - self.purchaseRecord[consumableId] = creditCount; - [self savePurchaseRecord]; - } -} - -#pragma mark - -#pragma mark Start requesting for available in app purchases - -- (void)startProductRequest { - NSMutableArray *productsArray = [NSMutableArray array]; - NSArray *consumables = [[MKStoreKit configs][@"Consumables"] allKeys]; - NSArray *others = [MKStoreKit configs][@"Others"]; - - [productsArray addObjectsFromArray:consumables]; - [productsArray addObjectsFromArray:others]; - - SKProductsRequest *productsRequest = [[SKProductsRequest alloc] - initWithProductIdentifiers:[NSSet setWithArray:productsArray]]; - productsRequest.delegate = self; - [productsRequest start]; -} - -- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response { - if (response.invalidProductIdentifiers.count > 0) { - NSLog(@"Invalid Product IDs: %@", response.invalidProductIdentifiers); - } - - self.availableProducts = response.products; - [[NSNotificationCenter defaultCenter] postNotificationName:kMKStoreKitProductsAvailableNotification - object:self.availableProducts]; -} - -- (void)request:(SKRequest *)request didFailWithError:(NSError *)error { - NSLog(@"Product request failed with error: %@", error); -} - -#pragma mark - -#pragma mark Restore Purchases - -- (void)restorePurchases { - [[SKPaymentQueue defaultQueue] restoreCompletedTransactions]; -} - -- (void)paymentQueue:(SKPaymentQueue *)queue restoreCompletedTransactionsFailedWithError:(NSError *)error { - [[NSNotificationCenter defaultCenter] postNotificationName:kMKStoreKitRestoringPurchasesFailedNotification object:error]; -} - -- (void)paymentQueueRestoreCompletedTransactionsFinished:(SKPaymentQueue *)queue { - [[NSNotificationCenter defaultCenter] postNotificationName:kMKStoreKitRestoredPurchasesNotification object:nil]; -} - -#pragma mark - -#pragma mark Initiate a Purchase - -- (void)initiatePaymentRequestForProductWithIdentifier:(NSString *)productId { - if (!self.availableProducts) { - // TODO: FIX ME - // Initializer might be running or internet might not be available - NSLog(@"No products are available. Did you initialize MKStoreKit by calling [[MKStoreKit sharedKit] startProductRequest]?"); - } - - if (![SKPaymentQueue canMakePayments]) { -#if TARGET_OS_IPHONE - [[[UIAlertView alloc] initWithTitle:NSLocalizedString(@"In App Purchasing Disabled", @"") - message:NSLocalizedString(@"Check your parental control settings and try again later", @"") - delegate:self - cancelButtonTitle:NSLocalizedString(@"Okay", @"") - otherButtonTitles:nil] show]; -#elif TARGET_OS_MAC - NSAlert *alert = [[NSAlert alloc] init]; - alert.messageText = NSLocalizedString(@"In App Purchasing Disabled", @""); - alert.informativeText = NSLocalizedString(@"Check your parental control settings and try again later", @""); - [alert runModal]; -#endif - return; - } - - [self.availableProducts enumerateObjectsUsingBlock:^(SKProduct *thisProduct, NSUInteger idx, BOOL *stop) { - if ([thisProduct.productIdentifier isEqualToString:productId]) { - *stop = YES; - SKPayment *payment = [SKPayment paymentWithProduct:thisProduct]; - [[SKPaymentQueue defaultQueue] addPayment:payment]; - } - }]; -} - -#pragma mark - -#pragma mark Receipt validation - -- (void)refreshAppStoreReceipt { - SKReceiptRefreshRequest *refreshReceiptRequest = [[SKReceiptRefreshRequest alloc] initWithReceiptProperties:nil]; - refreshReceiptRequest.delegate = self; - [refreshReceiptRequest start]; -} - -- (void)requestDidFinish:(SKRequest *)request { - // SKReceiptRefreshRequest - if([request isKindOfClass:[SKReceiptRefreshRequest class]]) { - NSURL *receiptUrl = [[NSBundle mainBundle] appStoreReceiptURL]; - if ([[NSFileManager defaultManager] fileExistsAtPath:[receiptUrl path]]) { - NSLog(@"App receipt exists. Preparing to validate and update local stores."); - [self startValidatingReceiptsAndUpdateLocalStore]; - } else { - NSLog(@"Receipt request completed but there is no receipt. The user may have refused to login, or the reciept is missing."); - // Disable features of your app, but do not terminate the app - } - } -} - -- (void)startValidatingAppStoreReceiptWithCompletionHandler:(void (^)(NSArray *receipts, NSError *error)) completionHandler { - NSURL *receiptURL = [[NSBundle mainBundle] appStoreReceiptURL]; - NSError *receiptError; - BOOL isPresent = [receiptURL checkResourceIsReachableAndReturnError:&receiptError]; - if (!isPresent) { - // No receipt - In App Purchase was never initiated - completionHandler(nil, nil); - return; - } - - NSData *receiptData = [NSData dataWithContentsOfURL:receiptURL]; - if (!receiptData) { - // Validation fails - NSLog(@"Receipt exists but there is no data available. Try refreshing the reciept payload and then checking again."); - completionHandler(nil, nil); - return; - } - - NSError *error; - NSMutableDictionary *requestContents = [NSMutableDictionary dictionaryWithObject: - [receiptData base64EncodedStringWithOptions:0] forKey:@"receipt-data"]; - NSString *sharedSecret = [MKStoreKit configs][@"SharedSecret"]; - if (sharedSecret) requestContents[@"password"] = sharedSecret; - - NSData *requestData = [NSJSONSerialization dataWithJSONObject:requestContents options:0 error:&error]; - -#ifdef DEBUG - NSMutableURLRequest *storeRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:kSandboxServer]]; -#else - NSMutableURLRequest *storeRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:kLiveServer]]; -#endif - - [storeRequest setHTTPMethod:@"POST"]; - [storeRequest setHTTPBody:requestData]; - - NSURLSession *session = [NSURLSession sessionWithConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration]]; - - [[session dataTaskWithRequest:storeRequest completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) { - if (!error) { - NSDictionary *jsonResponse = [NSJSONSerialization JSONObjectWithData:data options:0 error:&error]; - NSInteger status = [jsonResponse[@"status"] integerValue]; - NSString *originalAppVersion = jsonResponse[@"receipt"][@"original_application_version"]; - [self.purchaseRecord setObject:originalAppVersion forKey:kOriginalAppVersionKey]; - [self savePurchaseRecord]; - - if (status != 0) { - NSError *error = [NSError errorWithDomain:@"com.mugunthkumar.mkstorekit" code:status - userInfo:@{NSLocalizedDescriptionKey : errorDictionary[@(status)]}]; - completionHandler(nil, error); - } else { - NSMutableArray *receipts = [jsonResponse[@"latest_receipt_info"] mutableCopy]; - NSArray *inAppReceipts = jsonResponse[@"receipt"][@"in_app"]; - [receipts addObjectsFromArray:inAppReceipts]; - completionHandler(receipts, nil); - } - } else { - completionHandler(nil, error); - } - }] resume]; -} - -- (BOOL)purchasedAppBeforeVersion:(NSString *)requiredVersion { - NSString *actualVersion = [self.purchaseRecord objectForKey:kOriginalAppVersionKey]; - - if ([requiredVersion compare:actualVersion options:NSNumericSearch] == NSOrderedDescending) { - // actualVersion is lower than the requiredVersion - return YES; - } else return NO; -} - -- (void)startValidatingReceiptsAndUpdateLocalStore { - [self startValidatingAppStoreReceiptWithCompletionHandler:^(NSArray *receipts, NSError *error) { - if (error) { - NSLog(@"Receipt validation failed with error: %@", error); - [[NSNotificationCenter defaultCenter] postNotificationName:kMKStoreKitReceiptValidationFailedNotification object:error]; - } else { - __block BOOL purchaseRecordDirty = NO; - [receipts enumerateObjectsUsingBlock:^(NSDictionary *receiptDictionary, NSUInteger idx, BOOL *stop) { - NSString *productIdentifier = receiptDictionary[@"product_id"]; - NSNumber *expiresDateMs = receiptDictionary[@"expires_date_ms"]; - NSNumber *previouslyStoredExpiresDateMs = self.purchaseRecord[productIdentifier]; - if (expiresDateMs && ![expiresDateMs isKindOfClass:[NSNull class]] && ![previouslyStoredExpiresDateMs isKindOfClass:[NSNull class]]) { - if ([expiresDateMs doubleValue] > [previouslyStoredExpiresDateMs doubleValue]) { - self.purchaseRecord[productIdentifier] = expiresDateMs; - purchaseRecordDirty = YES; - } - } - }]; - - if (purchaseRecordDirty) [self savePurchaseRecord]; - - [self.purchaseRecord enumerateKeysAndObjectsUsingBlock:^(NSString *productIdentifier, NSNumber *expiresDateMs, BOOL *stop) { - if (![expiresDateMs isKindOfClass: [NSNull class]]) { - if ([[NSDate date] timeIntervalSince1970] > [expiresDateMs doubleValue]) { - [[NSNotificationCenter defaultCenter] postNotificationName:kMKStoreKitSubscriptionExpiredNotification object:productIdentifier]; - } - } - }]; - } - }]; -} - -#pragma mark - -#pragma mark Transaction Observers - -// TODO: FIX ME -- (void)paymentQueue:(SKPaymentQueue *)queue updatedDownloads:(NSArray *)downloads { - [downloads enumerateObjectsUsingBlock:^(SKDownload *thisDownload, NSUInteger idx, BOOL *stop) { -#if TARGET_OS_IPHONE - switch (thisDownload.downloadState) { - case SKDownloadStateActive: - break; - case SKDownloadStateFinished: - break; - default: - break; - } -#elif TARGET_OS_MAC - switch (thisDownload.state) { - case SKDownloadStateActive: - break; - case SKDownloadStateFinished: - break; - default: - break; - } -#endif - }]; -} - -- (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions { - for (SKPaymentTransaction *transaction in transactions) { - switch (transaction.transactionState) { - - case SKPaymentTransactionStatePurchasing: - break; - - case SKPaymentTransactionStateDeferred: - [self deferredTransaction:transaction inQueue:queue]; - break; - - case SKPaymentTransactionStateFailed: - [self failedTransaction:transaction inQueue:queue]; - break; - - case SKPaymentTransactionStatePurchased: - case SKPaymentTransactionStateRestored: { - - if (transaction.downloads.count > 0) { - [queue startDownloads:transaction.downloads]; - } - - [queue finishTransaction:transaction]; - - NSDictionary *availableConsumables = [MKStoreKit configs][@"Consumables"]; - NSArray *consumables = [availableConsumables allKeys]; - if ([consumables containsObject:transaction.payment.productIdentifier]) { - - NSDictionary *thisConsumable = availableConsumables[transaction.payment.productIdentifier]; - NSString *consumableId = thisConsumable[@"ConsumableId"]; - NSNumber *consumableCount = thisConsumable[@"ConsumableCount"]; - NSNumber *currentConsumableCount = self.purchaseRecord[consumableId]; - consumableCount = @([consumableCount doubleValue] + [currentConsumableCount doubleValue]); - self.purchaseRecord[consumableId] = consumableCount; - } else { - // non-consumable or subscriptions - // subscriptions will eventually contain the expiry date after the receipt is validated during the next run - self.purchaseRecord[transaction.payment.productIdentifier] = [NSNull null]; - } - - [self savePurchaseRecord]; - [[NSNotificationCenter defaultCenter] postNotificationName:kMKStoreKitProductPurchasedNotification - object:transaction.payment.productIdentifier]; - } - break; - } - } -} - -- (void)failedTransaction:(SKPaymentTransaction *)transaction inQueue:(SKPaymentQueue *)queue { - NSLog(@"Transaction Failed with error: %@", transaction.error); - [queue finishTransaction:transaction]; - [[NSNotificationCenter defaultCenter] postNotificationName:kMKStoreKitProductPurchaseFailedNotification - object:transaction.payment.productIdentifier]; -} - -- (void)deferredTransaction:(SKPaymentTransaction *)transaction inQueue:(SKPaymentQueue *)queue { - NSLog(@"Transaction Deferred: %@", transaction); - [[NSNotificationCenter defaultCenter] postNotificationName:kMKStoreKitProductPurchaseDeferredNotification - object:transaction.payment.productIdentifier]; -} - -@end diff --git a/MKStoreKit.podspec b/MKStoreKit.podspec new file mode 100644 index 0000000..8375cf0 --- /dev/null +++ b/MKStoreKit.podspec @@ -0,0 +1,23 @@ +Pod::Spec.new do |s| + s.name = "MKStoreKit" + s.version = "6.0.0" + s.summary = "The "Go to" In App Purchases Framework for iOS 7+" + s.description = <<-DESC + An in-App Purchase framework for iOS 7.0+. + MKStoreKit makes in-App Purchasing super simple by remembering your purchases, + validating reciepts, and tracking virtual currencies (consumable purchases). + Additionally, it keeps track of auto-renewable subscriptions and their expirationd dates. + It couldn't be easier! + DESC + s.homepage = "https://github.com/MugunthKumar/MKStoreKit" + s.license = 'MIT' + s.author = { "Mugunth Kumar" => "mugunth@steinlogic.com" } + s.source = { :git => "https://github.com/MugunthKumar/MKStoreKit.git", :tag => s.version.to_s } + + s.platform = :ios, '7.0' + s.requires_arc = true + + s.public_header_files = 'Pod/Classes/**/*.h' + s.source_files = 'Pod/Classes/**/*' + s.frameworks = 'StoreKit' +end diff --git a/MKStoreKitExample/MKStoreKitExample.xcodeproj/project.pbxproj b/MKStoreKitExample/MKStoreKitExample.xcodeproj/project.pbxproj new file mode 100644 index 0000000..73ad298 --- /dev/null +++ b/MKStoreKitExample/MKStoreKitExample.xcodeproj/project.pbxproj @@ -0,0 +1,532 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 2B3BDF477B82E82536C858A0 /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 62735C5178DAD5A8DCED446D /* libPods.a */; }; + 7FDA8347600D8192C661A6B2 /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 62735C5178DAD5A8DCED446D /* libPods.a */; }; + 992DFFD01AE2832600240ED2 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 992DFFCF1AE2832600240ED2 /* main.m */; }; + 992DFFD31AE2832600240ED2 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 992DFFD21AE2832600240ED2 /* AppDelegate.m */; }; + 992DFFD61AE2832600240ED2 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 992DFFD51AE2832600240ED2 /* ViewController.m */; }; + 992DFFD91AE2832600240ED2 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 992DFFD71AE2832600240ED2 /* Main.storyboard */; }; + 992DFFDB1AE2832600240ED2 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 992DFFDA1AE2832600240ED2 /* Images.xcassets */; }; + 992DFFDE1AE2832600240ED2 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 992DFFDC1AE2832600240ED2 /* LaunchScreen.xib */; }; + 992DFFEA1AE2832600240ED2 /* MKStoreKitExampleTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 992DFFE91AE2832600240ED2 /* MKStoreKitExampleTests.m */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 992DFFE41AE2832600240ED2 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 992DFFC21AE2832600240ED2 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 992DFFC91AE2832600240ED2; + remoteInfo = MKStoreKitExample; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + 175C2B6F7BBF1225D302A122 /* Pods.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.release.xcconfig; path = "Pods/Target Support Files/Pods/Pods.release.xcconfig"; sourceTree = ""; }; + 190EBA54856E364D3448F171 /* Pods.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.debug.xcconfig; path = "Pods/Target Support Files/Pods/Pods.debug.xcconfig"; sourceTree = ""; }; + 62735C5178DAD5A8DCED446D /* libPods.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPods.a; sourceTree = BUILT_PRODUCTS_DIR; }; + 992DFFCA1AE2832600240ED2 /* MKStoreKitExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MKStoreKitExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 992DFFCE1AE2832600240ED2 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 992DFFCF1AE2832600240ED2 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + 992DFFD11AE2832600240ED2 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; + 992DFFD21AE2832600240ED2 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; + 992DFFD41AE2832600240ED2 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; + 992DFFD51AE2832600240ED2 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; + 992DFFD81AE2832600240ED2 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 992DFFDA1AE2832600240ED2 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; + 992DFFDD1AE2832600240ED2 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; + 992DFFE31AE2832600240ED2 /* MKStoreKitExampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = MKStoreKitExampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 992DFFE81AE2832600240ED2 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 992DFFE91AE2832600240ED2 /* MKStoreKitExampleTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MKStoreKitExampleTests.m; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 992DFFC71AE2832600240ED2 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 2B3BDF477B82E82536C858A0 /* libPods.a in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 992DFFE01AE2832600240ED2 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 7FDA8347600D8192C661A6B2 /* libPods.a in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 65045B7BC4726F118C55C93B /* Pods */ = { + isa = PBXGroup; + children = ( + 190EBA54856E364D3448F171 /* Pods.debug.xcconfig */, + 175C2B6F7BBF1225D302A122 /* Pods.release.xcconfig */, + ); + name = Pods; + sourceTree = ""; + }; + 8AF66ACA513B9D7676868FAE /* Frameworks */ = { + isa = PBXGroup; + children = ( + 62735C5178DAD5A8DCED446D /* libPods.a */, + ); + name = Frameworks; + sourceTree = ""; + }; + 992DFFC11AE2832600240ED2 = { + isa = PBXGroup; + children = ( + 992DFFCC1AE2832600240ED2 /* MKStoreKitExample */, + 992DFFE61AE2832600240ED2 /* MKStoreKitExampleTests */, + 992DFFCB1AE2832600240ED2 /* Products */, + 65045B7BC4726F118C55C93B /* Pods */, + 8AF66ACA513B9D7676868FAE /* Frameworks */, + ); + sourceTree = ""; + }; + 992DFFCB1AE2832600240ED2 /* Products */ = { + isa = PBXGroup; + children = ( + 992DFFCA1AE2832600240ED2 /* MKStoreKitExample.app */, + 992DFFE31AE2832600240ED2 /* MKStoreKitExampleTests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + 992DFFCC1AE2832600240ED2 /* MKStoreKitExample */ = { + isa = PBXGroup; + children = ( + 992DFFD11AE2832600240ED2 /* AppDelegate.h */, + 992DFFD21AE2832600240ED2 /* AppDelegate.m */, + 992DFFD41AE2832600240ED2 /* ViewController.h */, + 992DFFD51AE2832600240ED2 /* ViewController.m */, + 992DFFD71AE2832600240ED2 /* Main.storyboard */, + 992DFFDA1AE2832600240ED2 /* Images.xcassets */, + 992DFFDC1AE2832600240ED2 /* LaunchScreen.xib */, + 992DFFCD1AE2832600240ED2 /* Supporting Files */, + ); + path = MKStoreKitExample; + sourceTree = ""; + }; + 992DFFCD1AE2832600240ED2 /* Supporting Files */ = { + isa = PBXGroup; + children = ( + 992DFFCE1AE2832600240ED2 /* Info.plist */, + 992DFFCF1AE2832600240ED2 /* main.m */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; + 992DFFE61AE2832600240ED2 /* MKStoreKitExampleTests */ = { + isa = PBXGroup; + children = ( + 992DFFE91AE2832600240ED2 /* MKStoreKitExampleTests.m */, + 992DFFE71AE2832600240ED2 /* Supporting Files */, + ); + path = MKStoreKitExampleTests; + sourceTree = ""; + }; + 992DFFE71AE2832600240ED2 /* Supporting Files */ = { + isa = PBXGroup; + children = ( + 992DFFE81AE2832600240ED2 /* Info.plist */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 992DFFC91AE2832600240ED2 /* MKStoreKitExample */ = { + isa = PBXNativeTarget; + buildConfigurationList = 992DFFED1AE2832600240ED2 /* Build configuration list for PBXNativeTarget "MKStoreKitExample" */; + buildPhases = ( + 0C321ACE2C2622D6182D1362 /* Check Pods Manifest.lock */, + 992DFFC61AE2832600240ED2 /* Sources */, + 992DFFC71AE2832600240ED2 /* Frameworks */, + 992DFFC81AE2832600240ED2 /* Resources */, + A976A2B013E290280E815726 /* Copy Pods Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = MKStoreKitExample; + productName = MKStoreKitExample; + productReference = 992DFFCA1AE2832600240ED2 /* MKStoreKitExample.app */; + productType = "com.apple.product-type.application"; + }; + 992DFFE21AE2832600240ED2 /* MKStoreKitExampleTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 992DFFF01AE2832600240ED2 /* Build configuration list for PBXNativeTarget "MKStoreKitExampleTests" */; + buildPhases = ( + 1DBA08D7DE641F818FDB7A0C /* Check Pods Manifest.lock */, + 992DFFDF1AE2832600240ED2 /* Sources */, + 992DFFE01AE2832600240ED2 /* Frameworks */, + 992DFFE11AE2832600240ED2 /* Resources */, + 90490FFEFCF6365F956C7528 /* Copy Pods Resources */, + ); + buildRules = ( + ); + dependencies = ( + 992DFFE51AE2832600240ED2 /* PBXTargetDependency */, + ); + name = MKStoreKitExampleTests; + productName = MKStoreKitExampleTests; + productReference = 992DFFE31AE2832600240ED2 /* MKStoreKitExampleTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 992DFFC21AE2832600240ED2 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0630; + ORGANIZATIONNAME = MKStoreKit; + TargetAttributes = { + 992DFFC91AE2832600240ED2 = { + CreatedOnToolsVersion = 6.3; + }; + 992DFFE21AE2832600240ED2 = { + CreatedOnToolsVersion = 6.3; + TestTargetID = 992DFFC91AE2832600240ED2; + }; + }; + }; + buildConfigurationList = 992DFFC51AE2832600240ED2 /* Build configuration list for PBXProject "MKStoreKitExample" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 992DFFC11AE2832600240ED2; + productRefGroup = 992DFFCB1AE2832600240ED2 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 992DFFC91AE2832600240ED2 /* MKStoreKitExample */, + 992DFFE21AE2832600240ED2 /* MKStoreKitExampleTests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 992DFFC81AE2832600240ED2 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 992DFFD91AE2832600240ED2 /* Main.storyboard in Resources */, + 992DFFDE1AE2832600240ED2 /* LaunchScreen.xib in Resources */, + 992DFFDB1AE2832600240ED2 /* Images.xcassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 992DFFE11AE2832600240ED2 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 0C321ACE2C2622D6182D1362 /* Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Check Pods Manifest.lock"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; + showEnvVarsInLog = 0; + }; + 1DBA08D7DE641F818FDB7A0C /* Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Check Pods Manifest.lock"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; + showEnvVarsInLog = 0; + }; + 90490FFEFCF6365F956C7528 /* Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Copy Pods Resources"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods/Pods-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; + A976A2B013E290280E815726 /* Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Copy Pods Resources"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods/Pods-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 992DFFC61AE2832600240ED2 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 992DFFD61AE2832600240ED2 /* ViewController.m in Sources */, + 992DFFD31AE2832600240ED2 /* AppDelegate.m in Sources */, + 992DFFD01AE2832600240ED2 /* main.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 992DFFDF1AE2832600240ED2 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 992DFFEA1AE2832600240ED2 /* MKStoreKitExampleTests.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 992DFFE51AE2832600240ED2 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 992DFFC91AE2832600240ED2 /* MKStoreKitExample */; + targetProxy = 992DFFE41AE2832600240ED2 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 992DFFD71AE2832600240ED2 /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 992DFFD81AE2832600240ED2 /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 992DFFDC1AE2832600240ED2 /* LaunchScreen.xib */ = { + isa = PBXVariantGroup; + children = ( + 992DFFDD1AE2832600240ED2 /* Base */, + ); + name = LaunchScreen.xib; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 992DFFEB1AE2832600240ED2 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.3; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 992DFFEC1AE2832600240ED2 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.3; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 992DFFEE1AE2832600240ED2 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 190EBA54856E364D3448F171 /* Pods.debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + INFOPLIST_FILE = MKStoreKitExample/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 992DFFEF1AE2832600240ED2 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 175C2B6F7BBF1225D302A122 /* Pods.release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + INFOPLIST_FILE = MKStoreKitExample/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; + 992DFFF11AE2832600240ED2 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 190EBA54856E364D3448F171 /* Pods.debug.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + FRAMEWORK_SEARCH_PATHS = ( + "$(SDKROOT)/Developer/Library/Frameworks", + "$(inherited)", + ); + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + INFOPLIST_FILE = MKStoreKitExampleTests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_NAME = "$(TARGET_NAME)"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/MKStoreKitExample.app/MKStoreKitExample"; + }; + name = Debug; + }; + 992DFFF21AE2832600240ED2 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 175C2B6F7BBF1225D302A122 /* Pods.release.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + FRAMEWORK_SEARCH_PATHS = ( + "$(SDKROOT)/Developer/Library/Frameworks", + "$(inherited)", + ); + INFOPLIST_FILE = MKStoreKitExampleTests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_NAME = "$(TARGET_NAME)"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/MKStoreKitExample.app/MKStoreKitExample"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 992DFFC51AE2832600240ED2 /* Build configuration list for PBXProject "MKStoreKitExample" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 992DFFEB1AE2832600240ED2 /* Debug */, + 992DFFEC1AE2832600240ED2 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 992DFFED1AE2832600240ED2 /* Build configuration list for PBXNativeTarget "MKStoreKitExample" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 992DFFEE1AE2832600240ED2 /* Debug */, + 992DFFEF1AE2832600240ED2 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 992DFFF01AE2832600240ED2 /* Build configuration list for PBXNativeTarget "MKStoreKitExampleTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 992DFFF11AE2832600240ED2 /* Debug */, + 992DFFF21AE2832600240ED2 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 992DFFC21AE2832600240ED2 /* Project object */; +} diff --git a/MKStoreKitExample/MKStoreKitExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/MKStoreKitExample/MKStoreKitExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..65743b0 --- /dev/null +++ b/MKStoreKitExample/MKStoreKitExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/MKStoreKitExample/MKStoreKitExample.xcworkspace/contents.xcworkspacedata b/MKStoreKitExample/MKStoreKitExample.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..d9baec3 --- /dev/null +++ b/MKStoreKitExample/MKStoreKitExample.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,10 @@ + + + + + + + diff --git a/MKStoreKitExample/MKStoreKitExample/AppDelegate.h b/MKStoreKitExample/MKStoreKitExample/AppDelegate.h new file mode 100644 index 0000000..5cfe072 --- /dev/null +++ b/MKStoreKitExample/MKStoreKitExample/AppDelegate.h @@ -0,0 +1,17 @@ +// +// AppDelegate.h +// MKStoreKitExample +// +// Created by Gianluca Tranchedone on 18/04/2015. +// Copyright (c) 2015 MKStoreKit. All rights reserved. +// + +#import + +@interface AppDelegate : UIResponder + +@property (strong, nonatomic) UIWindow *window; + + +@end + diff --git a/MKStoreKitExample/MKStoreKitExample/AppDelegate.m b/MKStoreKitExample/MKStoreKitExample/AppDelegate.m new file mode 100644 index 0000000..c0d17e9 --- /dev/null +++ b/MKStoreKitExample/MKStoreKitExample/AppDelegate.m @@ -0,0 +1,45 @@ +// +// AppDelegate.m +// MKStoreKitExample +// +// Created by Gianluca Tranchedone on 18/04/2015. +// Copyright (c) 2015 MKStoreKit. All rights reserved. +// + +#import "AppDelegate.h" + +@interface AppDelegate () + +@end + +@implementation AppDelegate + + +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { + // Override point for customization after application launch. + return YES; +} + +- (void)applicationWillResignActive:(UIApplication *)application { + // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. + // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. +} + +- (void)applicationDidEnterBackground:(UIApplication *)application { + // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. + // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. +} + +- (void)applicationWillEnterForeground:(UIApplication *)application { + // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. +} + +- (void)applicationDidBecomeActive:(UIApplication *)application { + // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. +} + +- (void)applicationWillTerminate:(UIApplication *)application { + // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. +} + +@end diff --git a/MKStoreKitExample/MKStoreKitExample/Base.lproj/LaunchScreen.xib b/MKStoreKitExample/MKStoreKitExample/Base.lproj/LaunchScreen.xib new file mode 100644 index 0000000..5639e88 --- /dev/null +++ b/MKStoreKitExample/MKStoreKitExample/Base.lproj/LaunchScreen.xib @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/MKStoreKitExample/MKStoreKitExample/Base.lproj/Main.storyboard b/MKStoreKitExample/MKStoreKitExample/Base.lproj/Main.storyboard new file mode 100644 index 0000000..f56d2f3 --- /dev/null +++ b/MKStoreKitExample/MKStoreKitExample/Base.lproj/Main.storyboard @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/MKStoreKitExample/MKStoreKitExample/Images.xcassets/AppIcon.appiconset/Contents.json b/MKStoreKitExample/MKStoreKitExample/Images.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..36d2c80 --- /dev/null +++ b/MKStoreKitExample/MKStoreKitExample/Images.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,68 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "3x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/MKStoreKitExample/MKStoreKitExample/Info.plist b/MKStoreKitExample/MKStoreKitExample/Info.plist new file mode 100644 index 0000000..3d590e8 --- /dev/null +++ b/MKStoreKitExample/MKStoreKitExample/Info.plist @@ -0,0 +1,47 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + mkstorekit.$(PRODUCT_NAME:rfc1034identifier) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/MKStoreKitExample/MKStoreKitExample/ViewController.h b/MKStoreKitExample/MKStoreKitExample/ViewController.h new file mode 100644 index 0000000..7a5d803 --- /dev/null +++ b/MKStoreKitExample/MKStoreKitExample/ViewController.h @@ -0,0 +1,15 @@ +// +// ViewController.h +// MKStoreKitExample +// +// Created by Gianluca Tranchedone on 18/04/2015. +// Copyright (c) 2015 MKStoreKit. All rights reserved. +// + +#import + +@interface ViewController : UIViewController + + +@end + diff --git a/MKStoreKitExample/MKStoreKitExample/ViewController.m b/MKStoreKitExample/MKStoreKitExample/ViewController.m new file mode 100644 index 0000000..f220ce9 --- /dev/null +++ b/MKStoreKitExample/MKStoreKitExample/ViewController.m @@ -0,0 +1,27 @@ +// +// ViewController.m +// MKStoreKitExample +// +// Created by Gianluca Tranchedone on 18/04/2015. +// Copyright (c) 2015 MKStoreKit. All rights reserved. +// + +#import "ViewController.h" + +@interface ViewController () + +@end + +@implementation ViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view, typically from a nib. +} + +- (void)didReceiveMemoryWarning { + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} + +@end diff --git a/MKStoreKitExample/MKStoreKitExample/main.m b/MKStoreKitExample/MKStoreKitExample/main.m new file mode 100644 index 0000000..a161ac0 --- /dev/null +++ b/MKStoreKitExample/MKStoreKitExample/main.m @@ -0,0 +1,16 @@ +// +// main.m +// MKStoreKitExample +// +// Created by Gianluca Tranchedone on 18/04/2015. +// Copyright (c) 2015 MKStoreKit. All rights reserved. +// + +#import +#import "AppDelegate.h" + +int main(int argc, char * argv[]) { + @autoreleasepool { + return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); + } +} diff --git a/MKStoreKitExample/MKStoreKitExampleTests/Info.plist b/MKStoreKitExample/MKStoreKitExampleTests/Info.plist new file mode 100644 index 0000000..7bccc94 --- /dev/null +++ b/MKStoreKitExample/MKStoreKitExampleTests/Info.plist @@ -0,0 +1,24 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + mkstorekit.$(PRODUCT_NAME:rfc1034identifier) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + + diff --git a/MKStoreKitExample/MKStoreKitExampleTests/MKStoreKitExampleTests.m b/MKStoreKitExample/MKStoreKitExampleTests/MKStoreKitExampleTests.m new file mode 100644 index 0000000..e8892f8 --- /dev/null +++ b/MKStoreKitExample/MKStoreKitExampleTests/MKStoreKitExampleTests.m @@ -0,0 +1,40 @@ +// +// MKStoreKitExampleTests.m +// MKStoreKitExampleTests +// +// Created by Gianluca Tranchedone on 18/04/2015. +// Copyright (c) 2015 MKStoreKit. All rights reserved. +// + +#import +#import + +@interface MKStoreKitExampleTests : XCTestCase + +@end + +@implementation MKStoreKitExampleTests + +- (void)setUp { + [super setUp]; + // Put setup code here. This method is called before the invocation of each test method in the class. +} + +- (void)tearDown { + // Put tearDown code here. This method is called after the invocation of each test method in the class. + [super tearDown]; +} + +- (void)testExample { + // This is an example of a functional test case. + XCTAssert(YES, @"Pass"); +} + +- (void)testPerformanceExample { + // This is an example of a performance test case. + [self measureBlock:^{ + // Put the code you want to measure the time of here. + }]; +} + +@end diff --git a/MKStoreKitExample/Podfile b/MKStoreKitExample/Podfile new file mode 100644 index 0000000..e06190b --- /dev/null +++ b/MKStoreKitExample/Podfile @@ -0,0 +1,6 @@ +source 'https://github.com/CocoaPods/Specs.git' +link_with :MKStoreKitExample, :MKStoreKitExampleTests +platform :ios, '7.0' +inhibit_all_warnings! + +pod 'MKStoreKit', :path => '../MKStoreKit.podspec' diff --git a/MKStoreKitExample/Podfile.lock b/MKStoreKitExample/Podfile.lock new file mode 100644 index 0000000..d91d1a4 --- /dev/null +++ b/MKStoreKitExample/Podfile.lock @@ -0,0 +1,14 @@ +PODS: + - MKStoreKit (6.0.0) + +DEPENDENCIES: + - MKStoreKit (from `../MKStoreKit.podspec`) + +EXTERNAL SOURCES: + MKStoreKit: + :path: "../MKStoreKit.podspec" + +SPEC CHECKSUMS: + MKStoreKit: 6f870f4e5722c2a754bb55e6744154ec02f2bfcc + +COCOAPODS: 0.36.4 diff --git a/MKStoreKitExample/Pods/Headers/Private/MKStoreKit/MKStoreKit.h b/MKStoreKitExample/Pods/Headers/Private/MKStoreKit/MKStoreKit.h new file mode 120000 index 0000000..c185565 --- /dev/null +++ b/MKStoreKitExample/Pods/Headers/Private/MKStoreKit/MKStoreKit.h @@ -0,0 +1 @@ +../../../../../Pod/Classes/MKStoreKit.h \ No newline at end of file diff --git a/MKStoreKitExample/Pods/Headers/Public/MKStoreKit/MKStoreKit.h b/MKStoreKitExample/Pods/Headers/Public/MKStoreKit/MKStoreKit.h new file mode 120000 index 0000000..c185565 --- /dev/null +++ b/MKStoreKitExample/Pods/Headers/Public/MKStoreKit/MKStoreKit.h @@ -0,0 +1 @@ +../../../../../Pod/Classes/MKStoreKit.h \ No newline at end of file diff --git a/MKStoreKitExample/Pods/Local Podspecs/MKStoreKit.podspec.json b/MKStoreKitExample/Pods/Local Podspecs/MKStoreKit.podspec.json new file mode 100644 index 0000000..1989676 --- /dev/null +++ b/MKStoreKitExample/Pods/Local Podspecs/MKStoreKit.podspec.json @@ -0,0 +1,22 @@ +{ + "name": "MKStoreKit", + "version": "6.0.0", + "summary": "An in-App Purchase framework for iOS 7.0+.", + "description": " An in-App Purchase framework for iOS 7.0+.\n MKStoreKit makes in-App Purchasing super simple by remembering your purchases,\n validating reciepts, and tracking virtual currencies (consumable purchases).\n Additionally, it keeps track of auto-renewable subscriptions and their expirationd dates.\n It couldn't be easier!\n", + "homepage": "https://github.com/MugunthKumar/MKStoreKit", + "license": "MIT", + "authors": { + "Mugunth Kumar": "mugunth@steinlogic.com" + }, + "source": { + "git": "https://github.com/MugunthKumar/MKStoreKit.git", + "tag": "6.0.0" + }, + "platforms": { + "ios": "7.0" + }, + "requires_arc": true, + "public_header_files": "Pod/Classes/**/*.h", + "source_files": "Pod/Classes/**/*", + "frameworks": "StoreKit" +} diff --git a/MKStoreKitExample/Pods/Manifest.lock b/MKStoreKitExample/Pods/Manifest.lock new file mode 100644 index 0000000..d91d1a4 --- /dev/null +++ b/MKStoreKitExample/Pods/Manifest.lock @@ -0,0 +1,14 @@ +PODS: + - MKStoreKit (6.0.0) + +DEPENDENCIES: + - MKStoreKit (from `../MKStoreKit.podspec`) + +EXTERNAL SOURCES: + MKStoreKit: + :path: "../MKStoreKit.podspec" + +SPEC CHECKSUMS: + MKStoreKit: 6f870f4e5722c2a754bb55e6744154ec02f2bfcc + +COCOAPODS: 0.36.4 diff --git a/MKStoreKitExample/Pods/Pods.xcodeproj/project.pbxproj b/MKStoreKitExample/Pods/Pods.xcodeproj/project.pbxproj new file mode 100644 index 0000000..3dc43cb --- /dev/null +++ b/MKStoreKitExample/Pods/Pods.xcodeproj/project.pbxproj @@ -0,0 +1,452 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 26E96506FA4915BC11A2B7CA /* Pods-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = CCDD398019A91D260A863003 /* Pods-dummy.m */; }; + 2B96E380E2B1D2EBE345A94D /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6B3E9575A7E59C10538450D5 /* Foundation.framework */; }; + 370213651CBFF3C616A0F9F3 /* Pods-MKStoreKit-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 855C9E0F540E648E06E7C2B5 /* Pods-MKStoreKit-dummy.m */; }; + 9354A28184F01BBB6A5E84DA /* MKStoreKit.m in Sources */ = {isa = PBXBuildFile; fileRef = 61864A275A8E4C8A840B7C17 /* MKStoreKit.m */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-checker -Xanalyzer deadcode"; }; }; + 9D3A4CBEC68CAB5CB2C32B57 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6B3E9575A7E59C10538450D5 /* Foundation.framework */; }; + D5FB77B991AB80071D94A0FC /* MKStoreKit.h in Headers */ = {isa = PBXBuildFile; fileRef = 04E78171B1F62BE186687FAB /* MKStoreKit.h */; }; + DD3DC5C1128079ED7704EB72 /* StoreKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7F30ECEE1A4237977F558AE5 /* StoreKit.framework */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + CDD62CFD1DED1ECFA08601AE /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 1A5B7B50DB5E2CA92884B7D0 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 54688FC7478A2390AF0F32A3; + remoteInfo = "Pods-MKStoreKit"; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + 04E78171B1F62BE186687FAB /* MKStoreKit.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = MKStoreKit.h; sourceTree = ""; }; + 3E870F2906315D43C70210BF /* libPods.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPods.a; sourceTree = BUILT_PRODUCTS_DIR; }; + 55C9E8ECB5A079F2ABC99D89 /* Pods.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = Pods.debug.xcconfig; sourceTree = ""; }; + 5CCC3F502A87E8485E0A49BD /* Pods-acknowledgements.markdown */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = "Pods-acknowledgements.markdown"; sourceTree = ""; }; + 61864A275A8E4C8A840B7C17 /* MKStoreKit.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = MKStoreKit.m; sourceTree = ""; }; + 6906486BC18736BA54F22416 /* Pods-MKStoreKit-Private.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-MKStoreKit-Private.xcconfig"; sourceTree = ""; }; + 6B3E9575A7E59C10538450D5 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; }; + 6E7156312B82F24F23BBB8BE /* Pods-acknowledgements.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-acknowledgements.plist"; sourceTree = ""; }; + 7F30ECEE1A4237977F558AE5 /* StoreKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = StoreKit.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk/System/Library/Frameworks/StoreKit.framework; sourceTree = DEVELOPER_DIR; }; + 855C9E0F540E648E06E7C2B5 /* Pods-MKStoreKit-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-MKStoreKit-dummy.m"; sourceTree = ""; }; + ABEF62EACA9E5BF513CC17BC /* Pods.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = Pods.release.xcconfig; sourceTree = ""; }; + B84FA1B608D45F36C46F93CD /* Pods-MKStoreKit-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Pods-MKStoreKit-prefix.pch"; sourceTree = ""; }; + C97E1CECB8533474491DB437 /* Pods-MKStoreKit.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-MKStoreKit.xcconfig"; sourceTree = ""; }; + CCDD398019A91D260A863003 /* Pods-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-dummy.m"; sourceTree = ""; }; + CD637501732424E66FDFC09C /* Podfile */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = Podfile; path = ../Podfile; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; + DB2B1DD3F095CC32DDD2B30C /* Pods-environment.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Pods-environment.h"; sourceTree = ""; }; + E62288A1A700A381D52E9F17 /* libPods-MKStoreKit.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-MKStoreKit.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + FBDD54FC20E1A98B9623DE05 /* Pods-resources.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-resources.sh"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 3652CC3F2A848901F6CF8917 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 9D3A4CBEC68CAB5CB2C32B57 /* Foundation.framework in Frameworks */, + DD3DC5C1128079ED7704EB72 /* StoreKit.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 86E6983B5D2E3654717D3776 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 2B96E380E2B1D2EBE345A94D /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 024762BA1F95E2A656377EC3 /* iOS */ = { + isa = PBXGroup; + children = ( + 6B3E9575A7E59C10538450D5 /* Foundation.framework */, + 7F30ECEE1A4237977F558AE5 /* StoreKit.framework */, + ); + name = iOS; + sourceTree = ""; + }; + 06FAF5134619C2A5433E4A75 /* Pods */ = { + isa = PBXGroup; + children = ( + 5CCC3F502A87E8485E0A49BD /* Pods-acknowledgements.markdown */, + 6E7156312B82F24F23BBB8BE /* Pods-acknowledgements.plist */, + CCDD398019A91D260A863003 /* Pods-dummy.m */, + DB2B1DD3F095CC32DDD2B30C /* Pods-environment.h */, + FBDD54FC20E1A98B9623DE05 /* Pods-resources.sh */, + 55C9E8ECB5A079F2ABC99D89 /* Pods.debug.xcconfig */, + ABEF62EACA9E5BF513CC17BC /* Pods.release.xcconfig */, + ); + name = Pods; + path = "Target Support Files/Pods"; + sourceTree = ""; + }; + 21D0BDD1A7E68CA3B4EE8151 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 024762BA1F95E2A656377EC3 /* iOS */, + ); + name = Frameworks; + sourceTree = ""; + }; + 36EF3EBBC2E78AA3F6CAB2B9 /* Development Pods */ = { + isa = PBXGroup; + children = ( + C52407529A2D06DC2670FC6D /* MKStoreKit */, + ); + name = "Development Pods"; + sourceTree = ""; + }; + 419DCA32BD7FB1CDDD32122F /* Support Files */ = { + isa = PBXGroup; + children = ( + C97E1CECB8533474491DB437 /* Pods-MKStoreKit.xcconfig */, + 6906486BC18736BA54F22416 /* Pods-MKStoreKit-Private.xcconfig */, + 855C9E0F540E648E06E7C2B5 /* Pods-MKStoreKit-dummy.m */, + B84FA1B608D45F36C46F93CD /* Pods-MKStoreKit-prefix.pch */, + ); + name = "Support Files"; + path = "MKStoreKitExample/Pods/Target Support Files/Pods-MKStoreKit"; + sourceTree = ""; + }; + 6CCD70302E679F8CF764B72D /* Targets Support Files */ = { + isa = PBXGroup; + children = ( + 06FAF5134619C2A5433E4A75 /* Pods */, + ); + name = "Targets Support Files"; + sourceTree = ""; + }; + 7190631C4F73C144D5EF250D /* Pod */ = { + isa = PBXGroup; + children = ( + D509192D4E8B464819D15CA7 /* Classes */, + ); + path = Pod; + sourceTree = ""; + }; + C52407529A2D06DC2670FC6D /* MKStoreKit */ = { + isa = PBXGroup; + children = ( + 7190631C4F73C144D5EF250D /* Pod */, + 419DCA32BD7FB1CDDD32122F /* Support Files */, + ); + name = MKStoreKit; + path = ../..; + sourceTree = ""; + }; + D1E838FB9F6E0B0D745D306C = { + isa = PBXGroup; + children = ( + CD637501732424E66FDFC09C /* Podfile */, + 36EF3EBBC2E78AA3F6CAB2B9 /* Development Pods */, + 21D0BDD1A7E68CA3B4EE8151 /* Frameworks */, + DA074BED3B102D26E7F9F10C /* Products */, + 6CCD70302E679F8CF764B72D /* Targets Support Files */, + ); + sourceTree = ""; + }; + D509192D4E8B464819D15CA7 /* Classes */ = { + isa = PBXGroup; + children = ( + 04E78171B1F62BE186687FAB /* MKStoreKit.h */, + 61864A275A8E4C8A840B7C17 /* MKStoreKit.m */, + ); + path = Classes; + sourceTree = ""; + }; + DA074BED3B102D26E7F9F10C /* Products */ = { + isa = PBXGroup; + children = ( + 3E870F2906315D43C70210BF /* libPods.a */, + E62288A1A700A381D52E9F17 /* libPods-MKStoreKit.a */, + ); + name = Products; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + 52C14AF52CD0887CF7786A4C /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + D5FB77B991AB80071D94A0FC /* MKStoreKit.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + 54688FC7478A2390AF0F32A3 /* Pods-MKStoreKit */ = { + isa = PBXNativeTarget; + buildConfigurationList = A0DE5FA049B86EFC6BDB393C /* Build configuration list for PBXNativeTarget "Pods-MKStoreKit" */; + buildPhases = ( + 1EF898E2B1EDCFE6CE7A1F54 /* Sources */, + 3652CC3F2A848901F6CF8917 /* Frameworks */, + 52C14AF52CD0887CF7786A4C /* Headers */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "Pods-MKStoreKit"; + productName = "Pods-MKStoreKit"; + productReference = E62288A1A700A381D52E9F17 /* libPods-MKStoreKit.a */; + productType = "com.apple.product-type.library.static"; + }; + 7B52C2CEEA3D3D6D0C8FAC17 /* Pods */ = { + isa = PBXNativeTarget; + buildConfigurationList = C94748196C076E0CEA423BFA /* Build configuration list for PBXNativeTarget "Pods" */; + buildPhases = ( + 69D5D5AE752AF30CE6C45592 /* Sources */, + 86E6983B5D2E3654717D3776 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + 87D079806E333A4E38C8A47A /* PBXTargetDependency */, + ); + name = Pods; + productName = Pods; + productReference = 3E870F2906315D43C70210BF /* libPods.a */; + productType = "com.apple.product-type.library.static"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 1A5B7B50DB5E2CA92884B7D0 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0510; + }; + buildConfigurationList = C654740CD576BEA75A52FDA8 /* Build configuration list for PBXProject "Pods" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = D1E838FB9F6E0B0D745D306C; + productRefGroup = DA074BED3B102D26E7F9F10C /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 7B52C2CEEA3D3D6D0C8FAC17 /* Pods */, + 54688FC7478A2390AF0F32A3 /* Pods-MKStoreKit */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXSourcesBuildPhase section */ + 1EF898E2B1EDCFE6CE7A1F54 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 9354A28184F01BBB6A5E84DA /* MKStoreKit.m in Sources */, + 370213651CBFF3C616A0F9F3 /* Pods-MKStoreKit-dummy.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 69D5D5AE752AF30CE6C45592 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 26E96506FA4915BC11A2B7CA /* Pods-dummy.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 87D079806E333A4E38C8A47A /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = "Pods-MKStoreKit"; + target = 54688FC7478A2390AF0F32A3 /* Pods-MKStoreKit */; + targetProxy = CDD62CFD1DED1ECFA08601AE /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin XCBuildConfiguration section */ + 48990FE8FDEA3C3023782804 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 6906486BC18736BA54F22416 /* Pods-MKStoreKit-Private.xcconfig */; + buildSettings = { + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_PREFIX_HEADER = "Target Support Files/Pods-MKStoreKit/Pods-MKStoreKit-prefix.pch"; + IPHONEOS_DEPLOYMENT_TARGET = 7.0; + MTL_ENABLE_DEBUG_INFO = YES; + OTHER_LDFLAGS = ""; + OTHER_LIBTOOLFLAGS = ""; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + }; + name = Debug; + }; + 799E24E49DF4EE095FA3DAC5 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 55C9E8ECB5A079F2ABC99D89 /* Pods.debug.xcconfig */; + buildSettings = { + ENABLE_STRICT_OBJC_MSGSEND = YES; + IPHONEOS_DEPLOYMENT_TARGET = 7.0; + MTL_ENABLE_DEBUG_INFO = YES; + OTHER_LDFLAGS = ""; + OTHER_LIBTOOLFLAGS = ""; + PODS_ROOT = "$(SRCROOT)"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + }; + name = Debug; + }; + 85D0AAA3BCC0A795132EA52A /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = YES; + ENABLE_NS_ASSERTIONS = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_PREPROCESSOR_DEFINITIONS = "RELEASE=1"; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 7.0; + STRIP_INSTALLED_PRODUCT = NO; + SYMROOT = "${SRCROOT}/../build"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + E9E2A939B8262263771757EB /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 7.0; + ONLY_ACTIVE_ARCH = YES; + STRIP_INSTALLED_PRODUCT = NO; + SYMROOT = "${SRCROOT}/../build"; + }; + name = Debug; + }; + EFDA515AD36963870F7BE63B /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = ABEF62EACA9E5BF513CC17BC /* Pods.release.xcconfig */; + buildSettings = { + ENABLE_STRICT_OBJC_MSGSEND = YES; + IPHONEOS_DEPLOYMENT_TARGET = 7.0; + MTL_ENABLE_DEBUG_INFO = NO; + OTHER_LDFLAGS = ""; + OTHER_LIBTOOLFLAGS = ""; + PODS_ROOT = "$(SRCROOT)"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + }; + name = Release; + }; + F665DD496FCB00AC42E0E2A5 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 6906486BC18736BA54F22416 /* Pods-MKStoreKit-Private.xcconfig */; + buildSettings = { + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_PREFIX_HEADER = "Target Support Files/Pods-MKStoreKit/Pods-MKStoreKit-prefix.pch"; + IPHONEOS_DEPLOYMENT_TARGET = 7.0; + MTL_ENABLE_DEBUG_INFO = NO; + OTHER_LDFLAGS = ""; + OTHER_LIBTOOLFLAGS = ""; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + A0DE5FA049B86EFC6BDB393C /* Build configuration list for PBXNativeTarget "Pods-MKStoreKit" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 48990FE8FDEA3C3023782804 /* Debug */, + F665DD496FCB00AC42E0E2A5 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + C654740CD576BEA75A52FDA8 /* Build configuration list for PBXProject "Pods" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + E9E2A939B8262263771757EB /* Debug */, + 85D0AAA3BCC0A795132EA52A /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + C94748196C076E0CEA423BFA /* Build configuration list for PBXNativeTarget "Pods" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 799E24E49DF4EE095FA3DAC5 /* Debug */, + EFDA515AD36963870F7BE63B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 1A5B7B50DB5E2CA92884B7D0 /* Project object */; +} diff --git a/MKStoreKitExample/Pods/Target Support Files/Pods-MKStoreKit/Pods-MKStoreKit-Private.xcconfig b/MKStoreKitExample/Pods/Target Support Files/Pods-MKStoreKit/Pods-MKStoreKit-Private.xcconfig new file mode 100644 index 0000000..439f62b --- /dev/null +++ b/MKStoreKitExample/Pods/Target Support Files/Pods-MKStoreKit/Pods-MKStoreKit-Private.xcconfig @@ -0,0 +1,6 @@ +#include "Pods-MKStoreKit.xcconfig" +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/MKStoreKit" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/MKStoreKit" +OTHER_LDFLAGS = ${PODS_MKSTOREKIT_OTHER_LDFLAGS} -ObjC +PODS_ROOT = ${SRCROOT} +SKIP_INSTALL = YES \ No newline at end of file diff --git a/MKStoreKitExample/Pods/Target Support Files/Pods-MKStoreKit/Pods-MKStoreKit-dummy.m b/MKStoreKitExample/Pods/Target Support Files/Pods-MKStoreKit/Pods-MKStoreKit-dummy.m new file mode 100644 index 0000000..db4f8a8 --- /dev/null +++ b/MKStoreKitExample/Pods/Target Support Files/Pods-MKStoreKit/Pods-MKStoreKit-dummy.m @@ -0,0 +1,5 @@ +#import +@interface PodsDummy_Pods_MKStoreKit : NSObject +@end +@implementation PodsDummy_Pods_MKStoreKit +@end diff --git a/MKStoreKitExample/Pods/Target Support Files/Pods-MKStoreKit/Pods-MKStoreKit-prefix.pch b/MKStoreKitExample/Pods/Target Support Files/Pods-MKStoreKit/Pods-MKStoreKit-prefix.pch new file mode 100644 index 0000000..95cf11d --- /dev/null +++ b/MKStoreKitExample/Pods/Target Support Files/Pods-MKStoreKit/Pods-MKStoreKit-prefix.pch @@ -0,0 +1,5 @@ +#ifdef __OBJC__ +#import +#endif + +#import "Pods-environment.h" diff --git a/MKStoreKitExample/Pods/Target Support Files/Pods-MKStoreKit/Pods-MKStoreKit.xcconfig b/MKStoreKitExample/Pods/Target Support Files/Pods-MKStoreKit/Pods-MKStoreKit.xcconfig new file mode 100644 index 0000000..d6ce1c8 --- /dev/null +++ b/MKStoreKitExample/Pods/Target Support Files/Pods-MKStoreKit/Pods-MKStoreKit.xcconfig @@ -0,0 +1 @@ +PODS_MKSTOREKIT_OTHER_LDFLAGS = -framework "StoreKit" \ No newline at end of file diff --git a/MKStoreKitExample/Pods/Target Support Files/Pods/Pods-acknowledgements.markdown b/MKStoreKitExample/Pods/Target Support Files/Pods/Pods-acknowledgements.markdown new file mode 100644 index 0000000..255149a --- /dev/null +++ b/MKStoreKitExample/Pods/Target Support Files/Pods/Pods-acknowledgements.markdown @@ -0,0 +1,3 @@ +# Acknowledgements +This application makes use of the following third party libraries: +Generated by CocoaPods - http://cocoapods.org diff --git a/MKStoreKitExample/Pods/Target Support Files/Pods/Pods-acknowledgements.plist b/MKStoreKitExample/Pods/Target Support Files/Pods/Pods-acknowledgements.plist new file mode 100644 index 0000000..e4edebe --- /dev/null +++ b/MKStoreKitExample/Pods/Target Support Files/Pods/Pods-acknowledgements.plist @@ -0,0 +1,29 @@ + + + + + PreferenceSpecifiers + + + FooterText + This application makes use of the following third party libraries: + Title + Acknowledgements + Type + PSGroupSpecifier + + + FooterText + Generated by CocoaPods - http://cocoapods.org + Title + + Type + PSGroupSpecifier + + + StringsTable + Acknowledgements + Title + Acknowledgements + + diff --git a/MKStoreKitExample/Pods/Target Support Files/Pods/Pods-dummy.m b/MKStoreKitExample/Pods/Target Support Files/Pods/Pods-dummy.m new file mode 100644 index 0000000..ade64bd --- /dev/null +++ b/MKStoreKitExample/Pods/Target Support Files/Pods/Pods-dummy.m @@ -0,0 +1,5 @@ +#import +@interface PodsDummy_Pods : NSObject +@end +@implementation PodsDummy_Pods +@end diff --git a/MKStoreKitExample/Pods/Target Support Files/Pods/Pods-environment.h b/MKStoreKitExample/Pods/Target Support Files/Pods/Pods-environment.h new file mode 100644 index 0000000..e371305 --- /dev/null +++ b/MKStoreKitExample/Pods/Target Support Files/Pods/Pods-environment.h @@ -0,0 +1,14 @@ + +// To check if a library is compiled with CocoaPods you +// can use the `COCOAPODS` macro definition which is +// defined in the xcconfigs so it is available in +// headers also when they are imported in the client +// project. + + +// MKStoreKit +#define COCOAPODS_POD_AVAILABLE_MKStoreKit +#define COCOAPODS_VERSION_MAJOR_MKStoreKit 6 +#define COCOAPODS_VERSION_MINOR_MKStoreKit 0 +#define COCOAPODS_VERSION_PATCH_MKStoreKit 0 + diff --git a/MKStoreKitExample/Pods/Target Support Files/Pods/Pods-resources.sh b/MKStoreKitExample/Pods/Target Support Files/Pods/Pods-resources.sh new file mode 100755 index 0000000..43f0852 --- /dev/null +++ b/MKStoreKitExample/Pods/Target Support Files/Pods/Pods-resources.sh @@ -0,0 +1,93 @@ +#!/bin/sh +set -e + +mkdir -p "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" + +RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt +> "$RESOURCES_TO_COPY" + +XCASSET_FILES=() + +realpath() { + DIRECTORY=$(cd "${1%/*}" && pwd) + FILENAME="${1##*/}" + echo "$DIRECTORY/$FILENAME" +} + +install_resource() +{ + case $1 in + *.storyboard) + echo "ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .storyboard`.storyboardc ${PODS_ROOT}/$1 --sdk ${SDKROOT}" + ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .storyboard`.storyboardc" "${PODS_ROOT}/$1" --sdk "${SDKROOT}" + ;; + *.xib) + echo "ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .xib`.nib ${PODS_ROOT}/$1 --sdk ${SDKROOT}" + ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .xib`.nib" "${PODS_ROOT}/$1" --sdk "${SDKROOT}" + ;; + *.framework) + echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" + mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" + echo "rsync -av ${PODS_ROOT}/$1 ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" + rsync -av "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" + ;; + *.xcdatamodel) + echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1"`.mom\"" + xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodel`.mom" + ;; + *.xcdatamodeld) + echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd\"" + xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd" + ;; + *.xcmappingmodel) + echo "xcrun mapc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcmappingmodel`.cdm\"" + xcrun mapc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcmappingmodel`.cdm" + ;; + *.xcassets) + ABSOLUTE_XCASSET_FILE=$(realpath "${PODS_ROOT}/$1") + XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE") + ;; + /*) + echo "$1" + echo "$1" >> "$RESOURCES_TO_COPY" + ;; + *) + echo "${PODS_ROOT}/$1" + echo "${PODS_ROOT}/$1" >> "$RESOURCES_TO_COPY" + ;; + esac +} + +rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" +if [[ "${ACTION}" == "install" ]]; then + rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" +fi +rm -f "$RESOURCES_TO_COPY" + +if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "$XCASSET_FILES" ] +then + case "${TARGETED_DEVICE_FAMILY}" in + 1,2) + TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone" + ;; + 1) + TARGET_DEVICE_ARGS="--target-device iphone" + ;; + 2) + TARGET_DEVICE_ARGS="--target-device ipad" + ;; + *) + TARGET_DEVICE_ARGS="--target-device mac" + ;; + esac + + # Find all other xcassets (this unfortunately includes those of path pods and other targets). + OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d) + while read line; do + if [[ $line != "`realpath $PODS_ROOT`*" ]]; then + XCASSET_FILES+=("$line") + fi + done <<<"$OTHER_XCASSETS" + + printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${IPHONEOS_DEPLOYMENT_TARGET}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" +fi diff --git a/MKStoreKitExample/Pods/Target Support Files/Pods/Pods.debug.xcconfig b/MKStoreKitExample/Pods/Target Support Files/Pods/Pods.debug.xcconfig new file mode 100644 index 0000000..7602f37 --- /dev/null +++ b/MKStoreKitExample/Pods/Target Support Files/Pods/Pods.debug.xcconfig @@ -0,0 +1,6 @@ +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/MKStoreKit" +OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/MKStoreKit" +OTHER_LDFLAGS = $(inherited) -ObjC -l"Pods-MKStoreKit" -framework "StoreKit" +OTHER_LIBTOOLFLAGS = $(OTHER_LDFLAGS) +PODS_ROOT = ${SRCROOT}/Pods \ No newline at end of file diff --git a/MKStoreKitExample/Pods/Target Support Files/Pods/Pods.release.xcconfig b/MKStoreKitExample/Pods/Target Support Files/Pods/Pods.release.xcconfig new file mode 100644 index 0000000..7602f37 --- /dev/null +++ b/MKStoreKitExample/Pods/Target Support Files/Pods/Pods.release.xcconfig @@ -0,0 +1,6 @@ +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/MKStoreKit" +OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/MKStoreKit" +OTHER_LDFLAGS = $(inherited) -ObjC -l"Pods-MKStoreKit" -framework "StoreKit" +OTHER_LIBTOOLFLAGS = $(OTHER_LDFLAGS) +PODS_ROOT = ${SRCROOT}/Pods \ No newline at end of file diff --git a/MKStoreKit.h b/Pod/Classes/MKStoreKit.h similarity index 92% rename from MKStoreKit.h rename to Pod/Classes/MKStoreKit.h index c21eca5..1915642 100644 --- a/MKStoreKit.h +++ b/Pod/Classes/MKStoreKit.h @@ -31,35 +31,36 @@ // 1) linking my website from your app's website // 2) or crediting me inside the app's credits page // 3) or a tweet mentioning @mugunthkumar -// 4) A paypal donation to mugunth.kumar@gmail.com +// 4) A PayPal donation to mugunth.kumar@gmail.com // // A note on redistribution // if you are re-publishing after editing, please retain the above copyright notices #import "TargetConditionals.h" -#if TARGET_OS_IPHONE - #import +@import Foundation; +#if TARGET_OS_IPHONE #ifndef __IPHONE_7_0 #error "MKStoreKit is only supported on iOS 7 or later." + #else + @import StoreKit; #endif - #else - #import - #import - + @import Cocoa; #ifndef __MAC_10_10 #error "MKStoreKit is only supported on OS X 10.10 or later." + #else + @import StoreKit; #endif - #endif #ifdef __OBJC__ -#if ! __has_feature(objc_arc) - #error MKStoreKit is ARC only. Either turn on ARC for the project or use -fobjc-arc flag -#endif + #if ! __has_feature(objc_arc) + #error MKStoreKit is ARC only. Either turn on ARC for the project or use -fobjc-arc flag + #endif #endif + /*! * @abstract This notification is posted when MKStoreKit completes initialization sequence */ @@ -106,22 +107,21 @@ extern NSString *const kMKStoreKitReceiptValidationFailedNotification; */ extern NSString *const kMKStoreKitSubscriptionExpiredNotification; - /*! * @abstract The singleton class that takes care of In App Purchasing * @discussion - * MKStoreKit provides three basic functionalities, namely, managing In App Purchases, + * MKStoreKit provides three basic functionality, namely, managing In App Purchases, * remembering purchases for you and also provides a basic virtual currency manager */ - @interface MKStoreKit : NSObject /*! - * @abstract Property that stores the list of available In App purchaseable products + * @abstract Property that stores the list of available In App purchasable products * * @discussion * This property is initialized after the call to startProductRequest completes * If the startProductRequest fails, this property will be nil + * * @seealso * -startProductRequest */ @@ -162,7 +162,7 @@ extern NSString *const kMKStoreKitSubscriptionExpiredNotification; * @abstract Refreshes the App Store receipt and prompts the user to authenticate. * * @discussion - * This method can generate a reciept while debugging your application. In a production + * This method can generate a receipt while debugging your application. In a production * environment this should only be used in an appropriate context because it will present * an App Store login alert to the user (without explanation). */ @@ -187,7 +187,7 @@ extern NSString *const kMKStoreKitSubscriptionExpiredNotification; * * @discussion * This method checks against the local store maintained by MKStoreKit when the app was originally purchased - * This method can be used to determine if a user should recieve a free upgrade. For example, apps transitioning + * This method can be used to determine if a user should receive a free upgrade. For example, apps transitioning * from a paid system to a freemium system can determine if users are "grandfathered-in" and exempt from extra * freemium purchases. * @@ -270,5 +270,15 @@ extern NSString *const kMKStoreKitSubscriptionExpiredNotification; */ - (void)setDefaultCredits:(NSNumber *)creditCount forConsumableIdentifier:(NSString *)consumableId; +@end + + +@interface MKStoreKit (TestsSupportExtractions) + ++ (BOOL)canMakePayments; ++ (SKPaymentQueue *)paymentQueue; ++ (SKPayment *)paymentWithProduct:(SKProduct *)product; ++ (SKProductsRequest *)productsRequestWithProductIdentifiers:(NSSet *)productIdentifiers; ++ (SKReceiptRefreshRequest *)receiptRefreshRequestWithProperties:(NSDictionary *)properties; @end diff --git a/Pod/Classes/MKStoreKit.m b/Pod/Classes/MKStoreKit.m new file mode 100644 index 0000000..8872d34 --- /dev/null +++ b/Pod/Classes/MKStoreKit.m @@ -0,0 +1,503 @@ +// +// MKStoreKit.m +// MKStoreKit 6.0 +// +// Copyright 2014 Steinlogic Consulting and Training Pte Ltd. All rights reserved. +// File created using Singleton Xcode Template by Mugunth Kumar (http://blog.mugunthkumar.com) +// More information about this template on the post http://mk.sg/89 +// Permission granted to do anything, commercial/non-commercial with this file apart from removing the line/URL above +// Created by Mugunth Kumar (@mugunthkumar) on 17 Nov 2014. +// Copyright (C) 2011-2020 by Steinlogic Consulting And Training Pte Ltd. + +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +// As a side note on using this code, you might consider giving some credit to me by +// 1) linking my website from your app's website +// 2) or crediting me inside the app's credits page +// 3) or a tweet mentioning @mugunthkumar +// 4) A PayPal donation to mugunth.kumar@gmail.com +// +// A note on redistribution +// if you are re-publishing after editing, please retain the above copyright notices + +#import "MKStoreKit.h" + +NSString *const kMKStoreKitProductsAvailableNotification = @"com.mugunthkumar.mkstorekit.productsavailable"; +NSString *const kMKStoreKitProductPurchasedNotification = @"com.mugunthkumar.mkstorekit.productspurchased"; +NSString *const kMKStoreKitProductPurchaseFailedNotification = @"com.mugunthkumar.mkstorekit.productspurchasefailed"; +NSString *const kMKStoreKitProductPurchaseDeferredNotification = @"com.mugunthkumar.mkstorekit.productspurchasedeferred"; +NSString *const kMKStoreKitRestoredPurchasesNotification = @"com.mugunthkumar.mkstorekit.restoredpurchases"; +NSString *const kMKStoreKitRestoringPurchasesFailedNotification = @"com.mugunthkumar.mkstorekit.failedrestoringpurchases"; +NSString *const kMKStoreKitReceiptValidationFailedNotification = @"com.mugunthkumar.mkstorekit.failedvalidatingreceipts"; +NSString *const kMKStoreKitSubscriptionExpiredNotification = @"com.mugunthkumar.mkstorekit.subscriptionexpired"; + +NSString *const kSandboxServer = @"https://sandbox.itunes.apple.com/verifyReceipt"; +NSString *const kLiveServer = @"https://buy.itunes.apple.com/verifyReceipt"; + +NSString *const kOriginalAppVersionKey = @"SKOrigBundleRef"; // Obfuscating record key name + +static NSDictionary *errorDictionary; + +@interface MKStoreKit () + +@property NSMutableDictionary *purchaseRecord; + +@end + +@implementation MKStoreKit (TestsSupportExtractions) + ++ (BOOL)canMakePayments { + return [SKPaymentQueue canMakePayments]; +} + ++ (SKPaymentQueue *)paymentQueue { + return [SKPaymentQueue defaultQueue]; +} + ++ (SKPayment *)paymentWithProduct:(SKProduct *)product { + return [SKPayment paymentWithProduct:product]; +} + ++ (SKProductsRequest *)productsRequestWithProductIdentifiers:(NSSet *)productIdentifiers { + return [[SKProductsRequest alloc] initWithProductIdentifiers:productIdentifiers]; +} + ++ (SKReceiptRefreshRequest *)receiptRefreshRequestWithProperties:(NSDictionary *)properties { + return [[SKReceiptRefreshRequest alloc] initWithReceiptProperties:nil]; +} + +@end + +@implementation MKStoreKit + +#pragma mark - +#pragma mark Singleton Methods + ++ (MKStoreKit *)sharedKit { + static MKStoreKit *_sharedKit; + if (!_sharedKit) { + static dispatch_once_t oncePredicate; + dispatch_once(& oncePredicate, ^{ + _sharedKit = [[super allocWithZone:nil] init]; + [[self paymentQueue] addTransactionObserver:_sharedKit]; + [_sharedKit restorePurchaseRecord]; +#if TARGET_OS_IPHONE + [[NSNotificationCenter defaultCenter] addObserver:_sharedKit + selector:@selector(savePurchaseRecord) + name:UIApplicationDidEnterBackgroundNotification object:nil]; +#elif TARGET_OS_MAC + [[NSNotificationCenter defaultCenter] addObserver:_sharedKit + selector:@selector(savePurchaseRecord) + name:NSApplicationDidResignActiveNotification object:nil]; +#endif + [_sharedKit startValidatingReceiptsAndUpdateLocalStore]; + }); + } + + return _sharedKit; +} + ++ (id)allocWithZone:(NSZone *)zone { + return [self sharedKit]; +} + +- (id)copyWithZone:(NSZone *)zone { + return self; +} + +#pragma mark - +#pragma mark Initializer + ++ (void)initialize { + errorDictionary = @{@(21000) : @"The App Store could not read the JSON object you provided.", + @(21002) : @"The data in the receipt-data property was malformed or missing.", + @(21003) : @"The receipt could not be authenticated.", + @(21004) : @"The shared secret you provided does not match the shared secret on file for your accunt.", + @(21005) : @"The receipt server is not currently available.", + @(21006) : @"This receipt is valid but the subscription has expired.", + @(21007) : @"This receipt is from the test environment.", + @(21008) : @"This receipt is from the production environment."}; +} + +#pragma mark - +#pragma mark Helpers + ++ (NSDictionary *)configs { + NSString *bundlePath = [[NSBundle bundleForClass:[self class]] resourcePath]; + NSString *configPlistPath = [bundlePath stringByAppendingPathComponent:@"MKStoreKitConfigs.plist"]; + return [NSDictionary dictionaryWithContentsOfFile:configPlistPath]; +} + +#pragma mark - +#pragma mark Store File Management + +- (NSString *)purchaseRecordFilePath { + NSString *documentDirectory = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES).firstObject; + return [documentDirectory stringByAppendingPathComponent:@"purchaserecord.plist"]; +} + +- (void)restorePurchaseRecord { + self.purchaseRecord = (NSMutableDictionary *)[[NSKeyedUnarchiver unarchiveObjectWithFile:[self purchaseRecordFilePath]] mutableCopy]; + if (!self.purchaseRecord) { + self.purchaseRecord = [NSMutableDictionary dictionary]; + } +} + +- (void)savePurchaseRecord { +#if TARGET_OS_IPHONE + NSDataWritingOptions writeOptionsMask = NSDataWritingAtomic | NSDataWritingFileProtectionComplete; +#elif TARGET_OS_MAC + NSDataWritingOptions writeOptionsMask = NSDataWritingAtomic; +#endif + + NSError *error = nil; + NSData *data = [NSKeyedArchiver archivedDataWithRootObject:self.purchaseRecord]; + BOOL success = [data writeToFile:[self purchaseRecordFilePath] options:writeOptionsMask error:&error]; + if (!success) { + NSLog(@"Failed to remember purchase records with error %@", error); + } + NSLog(@"%@", self.purchaseRecord); +} + +#pragma mark - +#pragma mark Feature Management + +- (BOOL)isProductPurchased:(NSString *)productId { + return [self.purchaseRecord.allKeys containsObject:productId]; +} + +- (NSDate *)expiryDateForProduct:(NSString *)productId { + NSNumber *expiresDateMs = self.purchaseRecord[productId]; + return [NSDate dateWithTimeIntervalSince1970:[expiresDateMs doubleValue] / 1000.0f]; +} + +- (NSNumber *)availableCreditsForConsumable:(NSString *)consumableId { + return self.purchaseRecord[consumableId]; +} + +- (NSNumber *)consumeCredits:(NSNumber *)creditCountToConsume identifiedByConsumableIdentifier:(NSString *)consumableId { + NSNumber *currentConsumableCount = self.purchaseRecord[consumableId]; + currentConsumableCount = @([currentConsumableCount doubleValue] - [creditCountToConsume doubleValue]); + self.purchaseRecord[consumableId] = currentConsumableCount; + [self savePurchaseRecord]; + return currentConsumableCount; +} + +- (void)setDefaultCredits:(NSNumber *)creditCount forConsumableIdentifier:(NSString *)consumableId { + if (!self.purchaseRecord[consumableId]) { + self.purchaseRecord[consumableId] = creditCount; + [self savePurchaseRecord]; + } +} + +#pragma mark - +#pragma mark Start requesting for available in app purchases + +- (void)startProductRequest { + NSMutableArray *productsArray = [NSMutableArray array]; + NSArray *consumables = [[MKStoreKit configs][@"Consumables"] allKeys]; + NSArray *others = [MKStoreKit configs][@"Others"]; + + [productsArray addObjectsFromArray:consumables]; + [productsArray addObjectsFromArray:others]; + + NSSet *productIdentifiers = [NSSet setWithArray:productsArray]; + SKProductsRequest *productsRequest = [[self class] productsRequestWithProductIdentifiers:productIdentifiers]; + productsRequest.delegate = self; + [productsRequest start]; +} + +- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response { + if (response.invalidProductIdentifiers.count > 0) { + NSLog(@"Invalid Product IDs: %@", response.invalidProductIdentifiers); + } + + self.availableProducts = response.products; + [[NSNotificationCenter defaultCenter] postNotificationName:kMKStoreKitProductsAvailableNotification + object:self.availableProducts]; +} + +- (void)request:(SKRequest *)request didFailWithError:(NSError *)error { + NSLog(@"Product request failed with error: %@", error); +} + +#pragma mark - +#pragma mark Restore Purchases + +- (void)restorePurchases { + [[[self class] paymentQueue] restoreCompletedTransactions]; +} + +- (void)paymentQueueRestoreCompletedTransactionsFinished:(SKPaymentQueue *)queue { + [[NSNotificationCenter defaultCenter] postNotificationName:kMKStoreKitRestoredPurchasesNotification object:nil]; +} + +- (void)paymentQueue:(SKPaymentQueue *)queue restoreCompletedTransactionsFailedWithError:(NSError *)error { + [[NSNotificationCenter defaultCenter] postNotificationName:kMKStoreKitRestoringPurchasesFailedNotification object:error]; +} + +#pragma mark - +#pragma mark Initiate a Purchase + +- (void)initiatePaymentRequestForProductWithIdentifier:(NSString *)productId { + if (!self.availableProducts) { + // TODO: FIX ME + // Initializer might be running or internet might not be available + NSLog(@"No products are available. Did you initialize MKStoreKit by calling [[MKStoreKit sharedKit] startProductRequest]?"); + } + + if (![[self class] canMakePayments]) { +#if TARGET_OS_IPHONE + [[[UIAlertView alloc] initWithTitle:NSLocalizedString(@"In App Purchasing Disabled", @"") + message:NSLocalizedString(@"Check your parental control settings and try again later", @"") + delegate:self + cancelButtonTitle:NSLocalizedString(@"Okay", @"") + otherButtonTitles:nil] show]; +#elif TARGET_OS_MAC + NSAlert *alert = [[NSAlert alloc] init]; + alert.messageText = NSLocalizedString(@"In App Purchasing Disabled", @""); + alert.informativeText = NSLocalizedString(@"Check your parental control settings and try again later", @""); + [alert runModal]; +#endif + return; + } + + [self.availableProducts enumerateObjectsUsingBlock:^(SKProduct *thisProduct, NSUInteger idx, BOOL *stop) { + if ([thisProduct.productIdentifier isEqualToString:productId]) { + * stop = YES; + [[[self class] paymentQueue] addPayment:[[self class] paymentWithProduct:thisProduct]]; + } + }]; +} + +#pragma mark - +#pragma mark Receipt validation + +- (void)refreshAppStoreReceipt { + SKReceiptRefreshRequest *refreshReceiptRequest = [[self class] receiptRefreshRequestWithProperties:nil]; + refreshReceiptRequest.delegate = self; + [refreshReceiptRequest start]; +} + +- (void)requestDidFinish:(SKRequest *)request { + // SKReceiptRefreshRequest + if ([request isKindOfClass:[SKReceiptRefreshRequest class]]) { + NSURL *receiptUrl = [[NSBundle bundleForClass:self.class] appStoreReceiptURL]; + if ([[NSFileManager defaultManager] fileExistsAtPath:[receiptUrl path]]) { + NSLog(@"App receipt exists. Preparing to validate and update local stores."); + [self startValidatingReceiptsAndUpdateLocalStore]; + } + else { + NSLog(@"Receipt request completed but there is no receipt. The user may have refused to login, or the reciept is missing."); + // Disable features of your app, but do not terminate the app + } + } +} + +- (void)startValidatingAppStoreReceiptWithCompletionHandler:(void (^)(NSArray *receipts, NSError *error))completionHandler { + NSError *receiptError = nil; + NSURL *receiptURL = [[NSBundle bundleForClass:self.class] appStoreReceiptURL]; + BOOL isPresent = [receiptURL checkResourceIsReachableAndReturnError:&receiptError]; + if (!isPresent) { + // No receipt - In App Purchase was never initiated + completionHandler(nil, nil); + return; + } + + NSData *receiptData = [NSData dataWithContentsOfURL:receiptURL]; + if (!receiptData) { + // Validation fails + NSLog(@"Receipt exists but there is no data available. Try refreshing the reciept payload and then checking again."); + completionHandler(nil, nil); + return; + } + + NSString *parsedReceiptData = [receiptData base64EncodedStringWithOptions:0]; + NSMutableDictionary *requestContents = [@{@"receipt-data" : parsedReceiptData} mutableCopy]; + NSString *sharedSecret = [MKStoreKit configs][@"SharedSecret"]; + if (sharedSecret) {requestContents[@"password"] = sharedSecret;} + + NSError *error = nil; + NSData *requestData = [NSJSONSerialization dataWithJSONObject:requestContents options:0 error:& error]; + +#ifdef DEBUG + NSMutableURLRequest *storeRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:kSandboxServer]]; +#else + NSMutableURLRequest *storeRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:kLiveServer]]; +#endif + + [storeRequest setHTTPMethod:@"POST"]; + [storeRequest setHTTPBody:requestData]; + + NSURLSession *session = [NSURLSession sessionWithConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration]]; + [[session dataTaskWithRequest:storeRequest completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) { + if (!error) { + NSDictionary *jsonResponse = [NSJSONSerialization JSONObjectWithData:data options:0 error:& error]; + NSInteger status = [jsonResponse[@"status"] integerValue]; + NSString *originalAppVersion = jsonResponse[@"receipt"][@"original_application_version"]; + self.purchaseRecord[kOriginalAppVersionKey] = originalAppVersion; + [self savePurchaseRecord]; + + if (status != 0) { + NSError *statusError = [NSError errorWithDomain:@"com.mugunthkumar.mkstorekit" code:status + userInfo:@{NSLocalizedDescriptionKey : errorDictionary[@(status)]}]; + completionHandler(nil, statusError); + } + else { + NSMutableArray *receipts = [jsonResponse[@"latest_receipt_info"] mutableCopy]; + NSArray *inAppReceipts = jsonResponse[@"receipt"][@"in_app"]; + [receipts addObjectsFromArray:inAppReceipts]; + completionHandler(receipts, nil); + } + } + else { + completionHandler(nil, error); + } + }] resume]; +} + +- (BOOL)purchasedAppBeforeVersion:(NSString *)requiredVersion { + NSString *actualVersion = self.purchaseRecord[kOriginalAppVersionKey]; + return [requiredVersion compare:actualVersion options:NSNumericSearch] == NSOrderedDescending; +} + +- (void)startValidatingReceiptsAndUpdateLocalStore { + [self startValidatingAppStoreReceiptWithCompletionHandler:^(NSArray *receipts, NSError *error) { + if (error) { + NSLog(@"Receipt validation failed with error: %@", error); + [[NSNotificationCenter defaultCenter] postNotificationName:kMKStoreKitReceiptValidationFailedNotification object:error]; + } + else { + __block BOOL purchaseRecordDirty = NO; + [receipts enumerateObjectsUsingBlock:^(NSDictionary *receiptDictionary, NSUInteger idx, BOOL *stop) { + NSString *productIdentifier = receiptDictionary[@"product_id"]; + NSNumber *expiresDateMs = receiptDictionary[@"expires_date_ms"]; + NSNumber *previouslyStoredExpiresDateMs = self.purchaseRecord[productIdentifier]; + if (expiresDateMs && ![expiresDateMs isKindOfClass:[NSNull class]] && ![previouslyStoredExpiresDateMs isKindOfClass:[NSNull class]]) { + if ([expiresDateMs doubleValue] > [previouslyStoredExpiresDateMs doubleValue]) { + self.purchaseRecord[productIdentifier] = expiresDateMs; + purchaseRecordDirty = YES; + } + } + }]; + + if (purchaseRecordDirty) {[self savePurchaseRecord];} + + [self.purchaseRecord enumerateKeysAndObjectsUsingBlock:^(NSString *productIdentifier, NSNumber *expiresDateMs, BOOL *stop) { + if (![expiresDateMs isKindOfClass:[NSNull class]]) { + if ([[NSDate date] timeIntervalSince1970] > [expiresDateMs doubleValue]) { + [[NSNotificationCenter defaultCenter] postNotificationName:kMKStoreKitSubscriptionExpiredNotification object:productIdentifier]; + } + } + }]; + } + }]; +} + +#pragma mark - +#pragma mark Transaction Observers + +// TODO: FIX ME +- (void)paymentQueue:(SKPaymentQueue *)queue updatedDownloads:(NSArray *)downloads { + [downloads enumerateObjectsUsingBlock:^(SKDownload *thisDownload, NSUInteger idx, BOOL *stop) { +#if TARGET_OS_IPHONE + switch (thisDownload.downloadState) { + case SKDownloadStateActive: + break; + case SKDownloadStateFinished: + break; + default: + break; + } +#elif TARGET_OS_MAC + switch (thisDownload.state) { + case SKDownloadStateActive: + break; + case SKDownloadStateFinished: + break; + default: + break; + } +#endif + }]; +} + +- (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions { + for (SKPaymentTransaction *transaction in transactions) { + switch (transaction.transactionState) { + case SKPaymentTransactionStatePurchasing: + break; + + case SKPaymentTransactionStateDeferred: + [self deferredTransaction:transaction inQueue:queue]; + break; + + case SKPaymentTransactionStateFailed: + [self failedTransaction:transaction inQueue:queue]; + break; + + case SKPaymentTransactionStatePurchased: + case SKPaymentTransactionStateRestored: { + + if (transaction.downloads.count > 0) { + [queue startDownloads:transaction.downloads]; + } + + [queue finishTransaction:transaction]; + + NSDictionary *availableConsumables = [MKStoreKit configs][@"Consumables"]; + NSArray *consumables = [availableConsumables allKeys]; + if ([consumables containsObject:transaction.payment.productIdentifier]) { + + NSDictionary *thisConsumable = availableConsumables[transaction.payment.productIdentifier]; + NSString *consumableId = thisConsumable[@"ConsumableId"]; + NSNumber *consumableCount = thisConsumable[@"ConsumableCount"]; + NSNumber *currentConsumableCount = self.purchaseRecord[consumableId]; + consumableCount = @([consumableCount doubleValue] + [currentConsumableCount doubleValue]); + self.purchaseRecord[consumableId] = consumableCount; + } + else { + // non-consumable or subscriptions + // subscriptions will eventually contain the expiry date after the receipt is validated during the next run + self.purchaseRecord[transaction.payment.productIdentifier] = [NSNull null]; + } + + [self savePurchaseRecord]; + [[NSNotificationCenter defaultCenter] postNotificationName:kMKStoreKitProductPurchasedNotification + object:transaction.payment.productIdentifier]; + } + break; + } + } +} + +- (void)failedTransaction:(SKPaymentTransaction *)transaction inQueue:(SKPaymentQueue *)queue { + NSLog(@"Transaction Failed with error: %@", transaction.error); + [queue finishTransaction:transaction]; + [[NSNotificationCenter defaultCenter] postNotificationName:kMKStoreKitProductPurchaseFailedNotification + object:transaction.payment.productIdentifier]; +} + +- (void)deferredTransaction:(SKPaymentTransaction *)transaction inQueue:(SKPaymentQueue *)queue { + NSLog(@"Transaction Deferred: %@", transaction); + [[NSNotificationCenter defaultCenter] postNotificationName:kMKStoreKitProductPurchaseDeferredNotification + object:transaction.payment.productIdentifier]; +} + +@end