TestsTested | ✓ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | May 2015 |
Maintained by Mattt.
The Essential StoreKit Companion
StoreKit
is the Apple framework for making In-App Purchases. It's pretty good, but it has a few rough edges.
CargoBay
smooths out those rough parts by providing:
This project is part of a series of open source libraries covering the mission-critical aspects of an iOS app's infrastructure. Be sure to check out its sister projects: GroundControl, SkyLab, houston, and Orbiter.
NSArray *identifiers = @[
@"com.example.myapp.apple",
@"com.example.myapp.pear",
@"com.example.myapp.banana"
];
[[CargoBay sharedManager] productsWithIdentifiers:[NSSet setWithArray:identifiers]
success:^(NSArray *products, NSArray *invalidIdentifiers) {
NSLog(@"Products: %@", products);
NSLog(@"Invalid Identifiers: %@", invalidIdentifiers);
} failure:^(NSError *error) {
NSLog(@"Error: %@", error);
}];
AppDelegate.m
- (void)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)options {
[[CargoBay sharedManager] setPaymentQueueUpdatedTransactionsBlock:^(SKPaymentQueue *queue, NSArray *transactions) {
NSLog(@"Updated Transactions: %@", transactions);
}];
[[SKPaymentQueue defaultQueue] addTransactionObserver:[CargoBay sharedManager]];
// ...
}
[[CargoBay sharedManager] verifyTransaction:transaction password:nil success:^(NSDictionary *receipt) {
NSLog(@"Receipt: %@", receipt);
} failure:^(NSError *error) {
NSLog(@"Error %d (%@)", [error code], [error localizedDescription]);
}];
Mattt Thompson
CargoBay is available under the MIT license. See the LICENSE file for more info.