Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added test app, fixed typos, added restoring.

  • Loading branch information...
commit 293cfd9cefbd84226b7901c35866d3428a2eaa7e 1 parent d5a2bcf
@millenomi authored
View
3  ILSimSKPaymentQueue.h
@@ -38,9 +38,10 @@
@protocol ILSimSKPaymentTransactionObserver <NSObject>
-
+@required
- (void) paymentQueue:(ILSimSKPaymentQueue*) queue updatedTransactions:(NSArray*) transactions;
+@optional
- (void) paymentQueue:(ILSimSKPaymentQueue*) queue removedTransactions:(NSArray*) transactions;
- (void) paymentQueue:(ILSimSKPaymentQueue*) queue restoreCompletedTransactionsFailedWithError:(NSError*) e;
View
57 ILSimSKPaymentQueue.m
@@ -11,6 +11,7 @@
#import "ILSimSKPaymentQueue.h"
#import "ILSimSKPaymentTransaction_Private.h"
#import "ILSimSKProductsRequest.h"
+#import "ILSimSKProduct_Private.h"
#define kILSimSKErrorDomain @"net.infinite-labs.SimulatedStoreKit"
enum {
@@ -146,12 +147,16 @@ - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)butto
- (void) succeed;
{
+ ILSimSKProduct* p = [ILSimSKProductsRequest simulatedProductForIdentifier:self.currentTransaction.payment.productIdentifier];
+
NSDictionary* r = [NSDictionary dictionaryWithObjectsAndKeys:
- self.currentTransaction.payment.productIdentifier, @"ProductID",
+ p.productIdentifier, @"ProductID",
[NSNumber numberWithInteger:self.currentTransaction.payment.quantity], @"Quantity",
self.currentTransaction.transactionIdentifier, @"TransactionID",
+ [NSNumber numberWithInteger:p.simulatedProductType], @"SimulatedProductType",
+ self.currentTransaction.transactionDate, @"Date",
nil];
-
+
NSString* err = nil;
NSData* d = [NSPropertyListSerialization dataFromPropertyList:r format:NSPropertyListBinaryFormat_v1_0 errorDescription:&err];
if (d)
@@ -162,13 +167,13 @@ - (void) succeed;
[err release];
}
- [self fail:[NSError errorWithDomain:kILSimSKErrorDomain code:kILSimNoSuchProduct userInfo:nil]];
+ [self fail:[NSError errorWithDomain:kILSimSKErrorDomain code:kILSimCannotMakeReceipt userInfo:nil]];
return;
}
self.currentTransaction.transactionState = kILSimSKPaymentTransactionStatePurchased;
- NSMutableArray* a = [[[[NSUserDefaults standardUserDefaults] objectForKey:@"ILSimSKTransactions"] mutableCopy] autorelease];
+ NSMutableArray* a = [[[[NSUserDefaults standardUserDefaults] arrayForKey:@"ILSimSKTransactions"] mutableCopy] autorelease];
if (!d)
a = [NSMutableArray array];
@@ -192,8 +197,10 @@ - (void) finishTransaction:(ILSimSKPaymentTransaction*) t;
if ([transactions count] > 0 && self.currentTransaction == [transactions objectAtIndex:0])
[transactions removeObjectAtIndex:0];
- for (id <ILSimSKPaymentTransactionObserver> o in observers)
- [o paymentQueue:self removedTransactions:[NSArray arrayWithObject:self.currentTransaction]];
+ for (id <ILSimSKPaymentTransactionObserver> o in observers) {
+ if ([o respondsToSelector:@selector(paymentQueue:removedTransactions:)])
+ [o paymentQueue:self removedTransactions:[NSArray arrayWithObject:self.currentTransaction]];
+ }
self.currentTransaction = nil;
@@ -203,7 +210,45 @@ - (void) finishTransaction:(ILSimSKPaymentTransaction*) t;
- (void) restoreCompletedTransactions;
{
+ srandomdev();
+
+ NSMutableArray* a = [NSMutableArray array];
+
+ for (id d in [[NSUserDefaults standardUserDefaults] arrayForKey:@"ILSimSKTransactions"]) {
+ if (![d isKindOfClass:[NSDictionary class]])
+ continue;
+
+ id kind = [d objectForKey:@"SimulatedProductType"];
+ if (!kind || ![kind isKindOfClass:[NSNumber class]] || [kind integerValue] != kILSimSimulatedProductTypeNonConsumable)
+ continue;
+
+ ILSimSKPaymentTransaction* t = [[ILSimSKPaymentTransaction new] autorelease];
+ t.transactionDate = [NSDate date];
+ t.transactionState = kILSimSKPaymentTransactionStateRestored;
+ t.transactionIdentifier = [NSString stringWithFormat:@"%lx", random()];
+
+ ILSimSKPaymentTransaction* original = [[ILSimSKPaymentTransaction new] autorelease];
+ original.transactionDate = [d objectForKey:@"TransactionDate"];
+ original.transactionIdentifier = [d objectForKey:@"TransactionID"];
+
+ ILSimSKMutablePayment* p = [ILSimSKMutablePayment paymentWithProductIdentifier:[d objectForKey:@"ProductID"]];
+ p.quantity = [[d objectForKey:@"Quantity"] integerValue];
+ original.payment = p;
+
+ t.originalTransaction = original;
+
+ [a addObject:t];
+ }
+ if ([a count] > 0) {
+ for (id <ILSimSKPaymentTransactionObserver> o in observers)
+ [o paymentQueue:self updatedTransactions:a];
+ }
+
+ for (id <ILSimSKPaymentTransactionObserver> o in observers) {
+ if ([o respondsToSelector:@selector(paymentQueueRestoreCompletedTransactionsFinished:)])
+ [o paymentQueueRestoreCompletedTransactionsFinished:self];
+ }
}
- (void) addTransactionObserver:(id <ILSimSKPaymentTransactionObserver>) o;
View
2  ILSimSKProduct.h
@@ -8,12 +8,14 @@
#import <Foundation/Foundation.h>
+typedef NSInteger ILSimSKSimulatedProductType;
@interface ILSimSKProduct : NSObject {
NSString* localizedDescription, * localizedTitle;
NSLocale* priceLocale;
NSDecimalNumber* price;
NSString* productIdentifier;
+ ILSimSKSimulatedProductType simulatedProductType;
}
@property(nonatomic, readonly, copy) NSString* localizedDescription;
View
2  ILSimSKProduct.m
@@ -11,7 +11,7 @@
@implementation ILSimSKProduct
-@synthesize localizedDescription, localizedTitle, price, priceLocale, productIdentifier;
+@synthesize localizedDescription, localizedTitle, price, priceLocale, productIdentifier, simulatedProductType;
- (void) dealloc
{
View
8 ILSimSKProduct_Private.h
@@ -1,6 +1,12 @@
#import "ILSimSKProduct.h"
+enum {
+ kILSimSimulatedProductTypeNonConsumable = 0,
+ kILSimSimulatedProductTypeConsumable,
+ kILSimSimulatedProductTypeSubscription,
+};
+
@interface ILSimSKProduct ()
@property(nonatomic, setter=private_setLocalizedDescription:, copy) NSString* localizedDescription;
@@ -11,4 +17,6 @@
@property(nonatomic, setter=private_setProductIdentifier:, copy) NSString* productIdentifier;
+@property(nonatomic, setter=private_setSimulatedProductType:) ILSimSKSimulatedProductType simulatedProductType;
+
@end
View
2  ILSimSKProductsRequest.m
@@ -61,7 +61,7 @@ - (void) start;
ILSimSKProductsResponse* r = [[[ILSimSKProductsResponse alloc] initWithProducts:prods invalidProductIdentifiers:badIDs] autorelease];
[self.delegate productsRequest:self didReceiveResponse:r];
- if (!cancelled)
+ if (!cancelled && [self.delegate respondsToSelector:@selector(requestDidFinish:)])
[self.delegate requestDidFinish:self];
}
View
1  ILSimSKRequest.h
@@ -28,6 +28,7 @@
@protocol ILSimSKRequestDelegate <NSObject>
+@optional
- (void)request:(ILSimSKRequest *)request didFailWithError:(NSError *)error;
- (void)requestDidFinish:(ILSimSKRequest *)request;
View
22 ILSimStoreKit.h
@@ -0,0 +1,22 @@
+
+#import "ILSimSKTiers.h"
+#import "ILSimSKPaymentTransaction.h"
+#import "ILSimSKProductsRequest.h"
+#import "ILSimSKPaymentQueue.h"
+#import "ILSimSKRequest.h"
+#import "ILSimSKPayment.h"
+#import "ILSimSKProduct.h"
+
+#if ILSimReplaceRealStoreKit
+
+#define SKPaymentTransaction ILSimSKPaymentTransaction
+#define SKProductsRequest ILSimSKProductsRequest
+#define SKPaymentQueue ILSimSKPaymentQueue
+#define SKRequest ILSimSKRequest
+#define SKProduct ILSimSKProduct
+#define SKPayment ILSimSKPayment
+#define SKProductsRequestDelegate ILSimSKProductsRequestDelegate
+#define SKPaymentTransactionObserver ILSimSKPaymentTransactionObserver
+#define SKRequestDelegate ILSimSKRequestDelegate
+
+#endif
View
339 MainWindow.xib
@@ -0,0 +1,339 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="7.10">
+ <data>
+ <int key="IBDocument.SystemTarget">784</int>
+ <string key="IBDocument.SystemVersion">10C540</string>
+ <string key="IBDocument.InterfaceBuilderVersion">740</string>
+ <string key="IBDocument.AppKitVersion">1038.25</string>
+ <string key="IBDocument.HIToolboxVersion">458.00</string>
+ <object class="NSMutableDictionary" key="IBDocument.PluginVersions">
+ <string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string key="NS.object.0">62</string>
+ </object>
+ <object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <integer value="2"/>
+ </object>
+ <object class="NSArray" key="IBDocument.PluginDependencies">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ </object>
+ <object class="NSMutableDictionary" key="IBDocument.Metadata">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys" id="0">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ </object>
+ <object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBProxyObject" id="841351856">
+ <string key="IBProxiedObjectIdentifier">IBFilesOwner</string>
+ </object>
+ <object class="IBProxyObject" id="450319686">
+ <string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
+ </object>
+ <object class="IBUIWindow" id="380026005">
+ <reference key="NSNextResponder"/>
+ <int key="NSvFlags">1316</int>
+ <object class="NSMutableArray" key="NSSubviews">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBUIButton" id="938425146">
+ <reference key="NSNextResponder" ref="380026005"/>
+ <int key="NSvFlags">1316</int>
+ <string key="NSFrame">{{122, 196}, {72, 37}}</string>
+ <reference key="NSSuperview" ref="380026005"/>
+ <bool key="IBUIOpaque">NO</bool>
+ <bool key="IBUIClearsContextBeforeDrawing">NO</bool>
+ <int key="IBUIContentHorizontalAlignment">0</int>
+ <int key="IBUIContentVerticalAlignment">0</int>
+ <object class="NSFont" key="IBUIFont">
+ <string key="NSName">Helvetica-Bold</string>
+ <double key="NSSize">15</double>
+ <int key="NSfFlags">16</int>
+ </object>
+ <int key="IBUIButtonType">1</int>
+ <string key="IBUINormalTitle">Prova</string>
+ <object class="NSColor" key="IBUIHighlightedTitleColor">
+ <int key="NSColorSpace">3</int>
+ <bytes key="NSWhite">MQA</bytes>
+ </object>
+ <object class="NSColor" key="IBUINormalTitleColor">
+ <int key="NSColorSpace">1</int>
+ <bytes key="NSRGB">MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA</bytes>
+ </object>
+ <object class="NSColor" key="IBUINormalTitleShadowColor">
+ <int key="NSColorSpace">3</int>
+ <bytes key="NSWhite">MC41AA</bytes>
+ </object>
+ </object>
+ </object>
+ <object class="NSPSMatrix" key="NSFrameMatrix"/>
+ <string key="NSFrameSize">{320, 480}</string>
+ <reference key="NSSuperview"/>
+ <object class="NSColor" key="IBUIBackgroundColor">
+ <int key="NSColorSpace">1</int>
+ <bytes key="NSRGB">MSAxIDEAA</bytes>
+ </object>
+ <bool key="IBUIOpaque">NO</bool>
+ <bool key="IBUIClearsContextBeforeDrawing">NO</bool>
+ <object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
+ </object>
+ <object class="IBUICustomObject" id="987256611"/>
+ </object>
+ <object class="IBObjectContainer" key="IBDocument.Objects">
+ <object class="NSMutableArray" key="connectionRecords">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">window</string>
+ <reference key="source" ref="987256611"/>
+ <reference key="destination" ref="380026005"/>
+ </object>
+ <int key="connectionID">8</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">delegate</string>
+ <reference key="source" ref="841351856"/>
+ <reference key="destination" ref="987256611"/>
+ </object>
+ <int key="connectionID">9</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchEventConnection" key="connection">
+ <string key="label">buy</string>
+ <reference key="source" ref="938425146"/>
+ <reference key="destination" ref="987256611"/>
+ <int key="IBEventType">7</int>
+ </object>
+ <int key="connectionID">10</int>
+ </object>
+ </object>
+ <object class="IBMutableOrderedSet" key="objectRecords">
+ <object class="NSArray" key="orderedObjects">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBObjectRecord">
+ <int key="objectID">0</int>
+ <reference key="object" ref="0"/>
+ <reference key="children" ref="1000"/>
+ <nil key="parent"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">2</int>
+ <reference key="object" ref="380026005"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="938425146"/>
+ </object>
+ <reference key="parent" ref="0"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">-1</int>
+ <reference key="object" ref="841351856"/>
+ <reference key="parent" ref="0"/>
+ <string key="objectName">File's Owner</string>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">-2</int>
+ <reference key="object" ref="450319686"/>
+ <reference key="parent" ref="0"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">6</int>
+ <reference key="object" ref="938425146"/>
+ <reference key="parent" ref="380026005"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">7</int>
+ <reference key="object" ref="987256611"/>
+ <reference key="parent" ref="0"/>
+ </object>
+ </object>
+ </object>
+ <object class="NSMutableDictionary" key="flattenedProperties">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>-1.CustomClassName</string>
+ <string>-2.CustomClassName</string>
+ <string>2.IBAttributePlaceholdersKey</string>
+ <string>2.IBEditorWindowLastContentRect</string>
+ <string>2.IBPluginDependency</string>
+ <string>2.UIWindow.visibleAtLaunch</string>
+ <string>6.IBPluginDependency</string>
+ <string>7.CustomClassName</string>
+ <string>7.IBPluginDependency</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>UIApplication</string>
+ <string>UIResponder</string>
+ <object class="NSMutableDictionary">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference key="dict.sortedKeys" ref="0"/>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ </object>
+ <string>{{593, 376}, {320, 480}}</string>
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <integer value="1"/>
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string>TestApp</string>
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ </object>
+ </object>
+ <object class="NSMutableDictionary" key="unlocalizedProperties">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference key="dict.sortedKeys" ref="0"/>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ </object>
+ <nil key="activeLocalization"/>
+ <object class="NSMutableDictionary" key="localizations">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference key="dict.sortedKeys" ref="0"/>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ </object>
+ <nil key="sourceID"/>
+ <int key="maxID">10</int>
+ </object>
+ <object class="IBClassDescriber" key="IBDocument.Classes">
+ <object class="NSMutableArray" key="referencedPartialClassDescriptions">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBPartialClassDescription">
+ <string key="className">TestApp</string>
+ <string key="superclassName">NSObject</string>
+ <object class="NSMutableDictionary" key="actions">
+ <string key="NS.key.0">buy</string>
+ <string key="NS.object.0">id</string>
+ </object>
+ <object class="NSMutableDictionary" key="outlets">
+ <string key="NS.key.0">window</string>
+ <string key="NS.object.0">UIWindow</string>
+ </object>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">TestApp.h</string>
+ </object>
+ </object>
+ </object>
+ <object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.2+">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">Foundation.framework/Headers/NSError.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">Foundation.framework/Headers/NSFileManager.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">Foundation.framework/Headers/NSKeyValueCoding.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">Foundation.framework/Headers/NSKeyValueObserving.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">Foundation.framework/Headers/NSKeyedArchiver.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">Foundation.framework/Headers/NSNetServices.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">Foundation.framework/Headers/NSObject.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">Foundation.framework/Headers/NSPort.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">Foundation.framework/Headers/NSRunLoop.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">Foundation.framework/Headers/NSStream.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">Foundation.framework/Headers/NSThread.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">Foundation.framework/Headers/NSURL.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">Foundation.framework/Headers/NSURLConnection.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">Foundation.framework/Headers/NSXMLParser.h</string>
+ </object>
+ </object>
+ </object>
+ </object>
+ <int key="IBDocument.localizationMode">0</int>
+ <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
+ <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3</string>
+ <integer value="3100" key="NS.object.0"/>
+ </object>
+ <bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
+ <string key="IBDocument.LastKnownRelativeProjectPath">SimStoreKit.xcodeproj</string>
+ <int key="IBDocument.defaultPropertyAccessControl">3</int>
+ <string key="IBCocoaTouchPluginVersion">3.1</string>
+ </data>
+</archive>
View
159 SimStoreKit.xcodeproj/project.pbxproj
@@ -7,6 +7,11 @@
objects = {
/* Begin PBXBuildFile section */
+ 15491D2E1119C69B000CE8BB /* ILSimStoreKit.h in Headers */ = {isa = PBXBuildFile; fileRef = 15491D2D1119C69B000CE8BB /* ILSimStoreKit.h */; };
+ 15491D501119C781000CE8BB /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 15491D4F1119C781000CE8BB /* main.m */; };
+ 15491D531119C79B000CE8BB /* libSimStoreKit.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D2AAC07E0554694100DB518D /* libSimStoreKit.a */; };
+ 15491D561119C7C7000CE8BB /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 15491D551119C7C7000CE8BB /* MainWindow.xib */; };
+ 15491D5E1119C7FB000CE8BB /* TestApp.m in Sources */ = {isa = PBXBuildFile; fileRef = 15491D5D1119C7FB000CE8BB /* TestApp.m */; };
155551DA111842630082EF0A /* ILSimSKPayment.h in Headers */ = {isa = PBXBuildFile; fileRef = 155551D8111842630082EF0A /* ILSimSKPayment.h */; };
155551DB111842630082EF0A /* ILSimSKPayment.m in Sources */ = {isa = PBXBuildFile; fileRef = 155551D9111842630082EF0A /* ILSimSKPayment.m */; };
155551EC111844230082EF0A /* ILSimSKProduct.h in Headers */ = {isa = PBXBuildFile; fileRef = 155551EA111844230082EF0A /* ILSimSKProduct.h */; };
@@ -27,7 +32,24 @@
AACBBE4A0F95108600F1A2B1 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AACBBE490F95108600F1A2B1 /* Foundation.framework */; };
/* End PBXBuildFile section */
+/* Begin PBXContainerItemProxy section */
+ 15491D511119C792000CE8BB /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = D2AAC07D0554694100DB518D /* SimStoreKit */;
+ remoteInfo = SimStoreKit;
+ };
+/* End PBXContainerItemProxy section */
+
/* Begin PBXFileReference section */
+ 15491D2D1119C69B000CE8BB /* ILSimStoreKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ILSimStoreKit.h; sourceTree = "<group>"; };
+ 15491D341119C715000CE8BB /* TestApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TestApp.app; sourceTree = BUILT_PRODUCTS_DIR; };
+ 15491D361119C715000CE8BB /* TestApp-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "TestApp-Info.plist"; sourceTree = "<group>"; };
+ 15491D4F1119C781000CE8BB /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
+ 15491D551119C7C7000CE8BB /* MainWindow.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MainWindow.xib; sourceTree = "<group>"; };
+ 15491D5C1119C7FB000CE8BB /* TestApp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestApp.h; sourceTree = "<group>"; };
+ 15491D5D1119C7FB000CE8BB /* TestApp.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TestApp.m; sourceTree = "<group>"; };
155551D8111842630082EF0A /* ILSimSKPayment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ILSimSKPayment.h; sourceTree = "<group>"; };
155551D9111842630082EF0A /* ILSimSKPayment.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ILSimSKPayment.m; sourceTree = "<group>"; };
155551EA111844230082EF0A /* ILSimSKProduct.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ILSimSKProduct.h; sourceTree = "<group>"; };
@@ -50,6 +72,14 @@
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
+ 15491D321119C715000CE8BB /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 15491D531119C79B000CE8BB /* libSimStoreKit.a in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
D2AAC07C0554694100DB518D /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
@@ -65,6 +95,7 @@
isa = PBXGroup;
children = (
D2AAC07E0554694100DB518D /* libSimStoreKit.a */,
+ 15491D341119C715000CE8BB /* TestApp.app */,
);
name = Products;
sourceTree = "<group>";
@@ -75,6 +106,7 @@
08FB77AEFE84172EC02AAC07 /* Classes */,
32C88DFF0371C24200C91783 /* Other Sources */,
0867D69AFE84028FC02AAC07 /* Frameworks */,
+ 15491D541119C7B6000CE8BB /* Resources */,
034768DFFF38A50411DB9C8B /* Products */,
);
name = SimStoreKit;
@@ -91,6 +123,7 @@
08FB77AEFE84172EC02AAC07 /* Classes */ = {
isa = PBXGroup;
children = (
+ 15491D3A1119C72A000CE8BB /* Test */,
15A2B0BF1118C74000A39BCE /* Tiers */,
1555520D1118AA850082EF0A /* ILSimSKPaymentTransaction.h */,
1555520E1118AA850082EF0A /* ILSimSKPaymentTransaction.m */,
@@ -106,10 +139,30 @@
155551EA111844230082EF0A /* ILSimSKProduct.h */,
15A2B0BC1118C6B600A39BCE /* ILSimSKProduct_Private.h */,
155551EB111844230082EF0A /* ILSimSKProduct.m */,
+ 15491D2D1119C69B000CE8BB /* ILSimStoreKit.h */,
);
name = Classes;
sourceTree = "<group>";
};
+ 15491D3A1119C72A000CE8BB /* Test */ = {
+ isa = PBXGroup;
+ children = (
+ 15491D4F1119C781000CE8BB /* main.m */,
+ 15491D5C1119C7FB000CE8BB /* TestApp.h */,
+ 15491D5D1119C7FB000CE8BB /* TestApp.m */,
+ );
+ name = Test;
+ sourceTree = "<group>";
+ };
+ 15491D541119C7B6000CE8BB /* Resources */ = {
+ isa = PBXGroup;
+ children = (
+ 15491D551119C7C7000CE8BB /* MainWindow.xib */,
+ 15491D361119C715000CE8BB /* TestApp-Info.plist */,
+ );
+ name = Resources;
+ sourceTree = "<group>";
+ };
15A2B0BF1118C74000A39BCE /* Tiers */ = {
isa = PBXGroup;
children = (
@@ -144,12 +197,31 @@
15A2B06A1118B63600A39BCE /* ILSimSKPaymentQueue.h in Headers */,
15A2B0BD1118C6B600A39BCE /* ILSimSKProduct_Private.h in Headers */,
15A2B0C21118C74800A39BCE /* ILSimSKTiers.h in Headers */,
+ 15491D2E1119C69B000CE8BB /* ILSimStoreKit.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXHeadersBuildPhase section */
/* Begin PBXNativeTarget section */
+ 15491D331119C715000CE8BB /* TestApp */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 15491D391119C716000CE8BB /* Build configuration list for PBXNativeTarget "TestApp" */;
+ buildPhases = (
+ 15491D301119C715000CE8BB /* Resources */,
+ 15491D311119C715000CE8BB /* Sources */,
+ 15491D321119C715000CE8BB /* Frameworks */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ 15491D521119C792000CE8BB /* PBXTargetDependency */,
+ );
+ name = TestApp;
+ productName = TestApp;
+ productReference = 15491D341119C715000CE8BB /* TestApp.app */;
+ productType = "com.apple.product-type.application";
+ };
D2AAC07D0554694100DB518D /* SimStoreKit */ = {
isa = PBXNativeTarget;
buildConfigurationList = 1DEB921E08733DC00010E9CD /* Build configuration list for PBXNativeTarget "SimStoreKit" */;
@@ -181,11 +253,32 @@
projectRoot = "";
targets = (
D2AAC07D0554694100DB518D /* SimStoreKit */,
+ 15491D331119C715000CE8BB /* TestApp */,
);
};
/* End PBXProject section */
+/* Begin PBXResourcesBuildPhase section */
+ 15491D301119C715000CE8BB /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 15491D561119C7C7000CE8BB /* MainWindow.xib in Resources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXResourcesBuildPhase section */
+
/* Begin PBXSourcesBuildPhase section */
+ 15491D311119C715000CE8BB /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 15491D501119C781000CE8BB /* main.m in Sources */,
+ 15491D5E1119C7FB000CE8BB /* TestApp.m in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
D2AAC07B0554694100DB518D /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
@@ -202,7 +295,64 @@
};
/* End PBXSourcesBuildPhase section */
+/* Begin PBXTargetDependency section */
+ 15491D521119C792000CE8BB /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = D2AAC07D0554694100DB518D /* SimStoreKit */;
+ targetProxy = 15491D511119C792000CE8BB /* PBXContainerItemProxy */;
+ };
+/* End PBXTargetDependency section */
+
/* Begin XCBuildConfiguration section */
+ 15491D371119C716000CE8BB /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ CODE_SIGN_IDENTITY = "iPhone Developer";
+ COPY_PHASE_STRIP = NO;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/UIKit.framework/Headers/UIKit.h";
+ INFOPLIST_FILE = "TestApp-Info.plist";
+ INSTALL_PATH = "$(HOME)/Applications";
+ OTHER_LDFLAGS = (
+ "-framework",
+ Foundation,
+ "-framework",
+ UIKit,
+ );
+ PREBINDING = NO;
+ PRODUCT_NAME = TestApp;
+ SDKROOT = iphoneos3.1.3;
+ };
+ name = Debug;
+ };
+ 15491D381119C716000CE8BB /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ CODE_SIGN_IDENTITY = "iPhone Developer";
+ COPY_PHASE_STRIP = YES;
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+ GCC_ENABLE_FIX_AND_CONTINUE = NO;
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/UIKit.framework/Headers/UIKit.h";
+ INFOPLIST_FILE = "TestApp-Info.plist";
+ INSTALL_PATH = "$(HOME)/Applications";
+ OTHER_LDFLAGS = (
+ "-framework",
+ Foundation,
+ "-framework",
+ UIKit,
+ );
+ PREBINDING = NO;
+ PRODUCT_NAME = TestApp;
+ SDKROOT = iphoneos3.1.3;
+ ZERO_LINK = NO;
+ };
+ name = Release;
+ };
1DEB921F08733DC00010E9CD /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
@@ -265,6 +415,15 @@
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
+ 15491D391119C716000CE8BB /* Build configuration list for PBXNativeTarget "TestApp" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 15491D371119C716000CE8BB /* Debug */,
+ 15491D381119C716000CE8BB /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
1DEB921E08733DC00010E9CD /* Build configuration list for PBXNativeTarget "SimStoreKit" */ = {
isa = XCConfigurationList;
buildConfigurations = (
View
22 TestApp-Info.plist
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>English</string>
+ <key>CFBundleExecutable</key>
+ <string>${EXECUTABLE_NAME}</string>
+ <key>CFBundleIdentifier</key>
+ <string>com.yourcompany.${PRODUCT_NAME:identifier}</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>1.0</string>
+ <key>NSMainNibFile</key>
+ <string>MainWindow</string>
+</dict>
+</plist>
View
19 TestApp.h
@@ -0,0 +1,19 @@
+//
+// TestApp.h
+// SimStoreKit
+//
+// Created by ∞ on 03/02/10.
+// Copyright 2010 __MyCompanyName__. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+#define ILSimReplaceRealStoreKit 1
+#import "ILSimStoreKit.h"
+
+@interface TestApp : NSObject <UIApplicationDelegate, SKPaymentTransactionObserver, SKProductsRequestDelegate> {
+ IBOutlet UIWindow* window;
+}
+
+- (IBAction) buy;
+
+@end
View
44 TestApp.m
@@ -0,0 +1,44 @@
+//
+// TestApp.m
+// SimStoreKit
+//
+// Created by ∞ on 03/02/10.
+// Copyright 2010 __MyCompanyName__. All rights reserved.
+//
+
+#import "TestApp.h"
+
+@implementation TestApp
+
+- (BOOL) application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions;
+{
+ [[SKPaymentQueue defaultQueue] addTransactionObserver:self];
+ [window makeKeyAndVisible];
+ return YES;
+}
+
+- (IBAction) buy;
+{
+ SKProductsRequest* pr = [[SKProductsRequest alloc] initWithProductIdentifiers:
+ [NSSet setWithObject:@"TestItem"]
+ ];
+ pr.delegate = self;
+ [pr start];
+}
+
+- (void) productsRequest:(ILSimSKProductsRequest *)request didReceiveResponse:(ILSimSKProductsResponse *)response;
+{
+ if ([response.products count] == 0)
+ return;
+
+ SKProduct* p = [response.products objectAtIndex:0];
+ SKPayment* pay = [SKPayment paymentWithProduct:p];
+ [[SKPaymentQueue defaultQueue] addPayment:pay];
+}
+
+- (void) paymentQueue:(ILSimSKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions;
+{
+ NSLog(@"%@", transactions);
+}
+
+@end
View
17 main.m
@@ -0,0 +1,17 @@
+//
+// main.m
+// Shard
+//
+// Created by ∞ on 21/03/09.
+// Copyright __MyCompanyName__ 2009. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+int main(int argc, char *argv[]) {
+
+ NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
+ int retVal = UIApplicationMain(argc, argv, nil, nil);
+ [pool release];
+ return retVal;
+}
Please sign in to comment.
Something went wrong with that request. Please try again.