Permalink
Browse files

improved Readme

  • Loading branch information...
1 parent 95f7f1a commit 2ca223b6428c6f1db623c7d244c009be49d369fe Misha Karpenko committed Jun 4, 2012
View
@@ -19,11 +19,16 @@ So you basically request price and then execute the payment. That simple.
##How to use
-1. Add StoreKit framework to your project at Build Phases > Link Binary With Libraries.
-2. Add [Reachability](https://github.com/tonymillion/Reachability) to your project.
-3. Import `StoreKISS.h` and start using.
+###Cocoapods users
-CocoaPods spec will be added soon.
+StoreKISS spec will be added to the main spec repository soon, we're right now going through pull request acceptance (see [https://github.com/CocoaPods/Specs/pull/211](https://github.com/CocoaPods/Specs/pull/211)).
+
+###Everyone else
+
+1. Add Apple's StoreKit framework to your project at Build Phases > Link Binary With Libraries.
+1. Download (or checkout) [Reachability](https://github.com/tonymillion/Reachability) and drop in Reachability.h and .m files into your project.
+1. Also download and drop in StoreKISS/Classes dir to your project.
+1. `#import "StoreKISS.h"` wherever you need it and start using.
##Usage examples
@@ -36,11 +41,13 @@ StoreKISSDataRequest *dataRequest = [[StoreKISSDataRequest alloc] init];
[dataRequest
requestDataForItemWithProductId:@"com.example.myProduct"
success:^(StoreKISSDataRequest *dataRequest) {
- NSLog(@"Received payment data.")
+ NSLog(@"Received payment data.");
+ NSLog(@"Products %@", dataRequest.skResponse.products);
+ NSLog(@"Invalid product IDs %@", dataRequest.skResponse.invalidIdentifiers);
} failure:^(NSError *error) {
- NSLog(@"Houston, we have a problem: %@"), error.localizedDescription);
+ NSLog(@"Houston, we have a problem: %@"), error.localizedDescription);
}];
- ```
+```
###Requesting data using notifications
@@ -66,11 +73,13 @@ Notification handler:
```objc
- (void)didReceiveDataRequestNotificationSuccess:(NSNotification *)notification
{
- NSLog(@"Received notification %@, data request object %@", notification.name, notification.object);
+ NSLog(@"Received notification %@", notification.name);
+ StoreKISSDataRequest *dataRequest = (StoreKISSDataRequest *)notification.object;
+ NSLog(@"Products %@", dataRequest.skResponse.products);
+ NSLog(@"Invalid product IDs %@", dataRequest.skResponse.invalidIdentifiers);
}
```
-
-
+
Don't forget to remove the observer:
```objc
@@ -84,9 +93,73 @@ Don't forget to remove the observer:
}
```
+###Buying a product using blocks
+
+```objc
+StoreKISSPaymentRequest *paymentRequest = [[StoreKISSPaymentRequest alloc] init];
+[paymentRequest
+ makePaymentWithSKProduct:skProduct
+ success:^(StoreKISSPaymentRequest *paymentRequest) {
+ NSLog(@"Product was bought successfully.");
+ NSLog(@"Transaction ID %@", paymentRequest.transaction.transactionIdentifier);
+ } failure:^(NSError *error) {
+ NSLog(@"Houston, we have a problem: %@"), error.localizedDescription);
+ }];
+```
+
+###Buying a product using notifications
+
+To register observer:
+
+```objc
+[[NSNotificationCenter defaultCenter]
+ addObserver:self
+ selector:@selector(didReceivePaymentRequestNotificationSuccess:)
+ name:StoreKISSNotificationPaymentRequestSuccess
+ object:nil];
+```
+
+To buy product:
+
+```objc
+StoreKISSPaymentRequest *paymentRequest = [[StoreKISSPaymentRequest alloc] init];
+[paymentRequest makePaymentWithSKProduct:skProduct];
+```
+
+Notification handler:
+
+```objc
+- (void)didReceivePaymentRequestNotificationSuccess:(NSNotification *)notification
+{
+ NSLog(@"Received notification %@", notification.name);
+ StoreKISSPaymentRequest *paymentRequest = (StoreKISSPaymentRequest *)notification.object;
+ NSLog(@"Transaction ID %@", paymentRequest.transaction.transactionIdentifier);
+}
+```
+
+Don't forget to remove the observer:
+
+```objc
+- (void)dealloc
+{
+ [[NSNotificationCenter defaultCenter]
+ removeObserver:self
+ name:StoreKISSNotificationPaymentRequestSuccess
+ object:nil];
+}
+```
+
+##Example
+
+The project provided with StoreKISS is *not* a demo, it is for running UIAutomation Tests.
+
+In-App Purchase testing mechanism requires you to sign the app with a specific developer certificate and create an IAP item and a test user at the iTunesConnect portal. I can't provide you with all of these so demo will not run for you as expected.
+
+Nevertheless before every new feature is commited UIAutomation Tests are run to test everything.
+
##Documentation
-Documentation for the project is built with [appledoc](http://gentlebytes.com/appledoc/). You can install it in Xcode via `make doc-install`. Make sure appledoc is installed.
+Documentation for the project is built with [appledoc](http://gentlebytes.com/appledoc/). You can install it in Xcode via `make doc-install`. Make sure [appledoc is installed](https://github.com/tomaz/appledoc#quick-install).
##Support

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

0 comments on commit 2ca223b

Please sign in to comment.