在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:robotmedia/RMStore开源软件地址:https://github.com/robotmedia/RMStore开源编程语言:C 81.3%开源软件介绍:#RMStore A lightweight iOS library for In-App Purchases. RMStore adds blocks and notifications to StoreKit, plus receipt verification, content downloads and transaction persistence. All in one class without external dependencies. Purchasing a product is as simple as: [[RMStore defaultStore] addPayment:productID success:^(SKPaymentTransaction *transaction) {
NSLog(@"Purchased!");
} failure:^(SKPaymentTransaction *transaction, NSError *error) {
NSLog(@"Something went wrong");
}]; ##Installation Using CocoaPods: pod 'RMStore', '~> 0.7' Or add the files from the RMStore directory if you're doing it manually. Check out the wiki for more options. ##StoreKit with blocks RMStore adds blocks to all asynchronous StoreKit operations. ###Requesting products NSSet *products = [NSSet setWithArray:@[@"fabulousIdol", @"rootBeer", @"rubberChicken"]];
[[RMStore defaultStore] requestProducts:products success:^(NSArray *products, NSArray *invalidProductIdentifiers) {
NSLog(@"Products loaded");
} failure:^(NSError *error) {
NSLog(@"Something went wrong");
}]; ###Add payment [[RMStore defaultStore] addPayment:@"waxLips" success:^(SKPaymentTransaction *transaction) {
NSLog(@"Product purchased");
} failure:^(SKPaymentTransaction *transaction, NSError *error) {
NSLog(@"Something went wrong");
}]; ###Restore transactions [[RMStore defaultStore] restoreTransactionsOnSuccess:^(NSArray *transactions){
NSLog(@"Transactions restored");
} failure:^(NSError *error) {
NSLog(@"Something went wrong");
}]; ###Refresh receipt (iOS 7+ only) [[RMStore defaultStore] refreshReceiptOnSuccess:^{
NSLog(@"Receipt refreshed");
} failure:^(NSError *error) {
NSLog(@"Something went wrong");
}]; ##Notifications RMStore sends notifications of StoreKit related events and extends ###Adding and removing the observer [[RMStore defaultStore] addStoreObserver:self];
...
[[RMStore defaultStore] removeStoreObserver:self]; ###Products request notifications - (void)storeProductsRequestFailed:(NSNotification*)notification
{
NSError *error = notification.rm_storeError;
}
- (void)storeProductsRequestFinished:(NSNotification*)notification
{
NSArray *products = notification.rm_products;
NSArray *invalidProductIdentifiers = notification.rm_invalidProductIdentififers;
} ###Payment transaction notifications Payment transaction notifications are sent after a payment has been requested or for each restored transaction. - (void)storePaymentTransactionFinished:(NSNotification*)notification
{
NSString *productIdentifier = notification.rm_productIdentifier;
SKPaymentTransaction *transaction = notification.rm_transaction;
}
- (void)storePaymentTransactionFailed:(NSNotification*)notification
{
NSError *error = notification.rm_storeError;
NSString *productIdentifier = notification.rm_productIdentifier;
SKPaymentTransaction *transaction = notification.rm_transaction;
}
// iOS 8+ only
- (void)storePaymentTransactionDeferred:(NSNotification*)notification
{
NSString *productIdentifier = notification.rm_productIdentifier;
SKPaymentTransaction *transaction = notification.rm_transaction;
} ###Restore transactions notifications - (void)storeRestoreTransactionsFailed:(NSNotification*)notification;
{
NSError *error = notification.rm_storeError;
}
- (void)storeRestoreTransactionsFinished:(NSNotification*)notification
{
NSArray *transactions = notification.rm_transactions;
} ###Download notifications (iOS 6+ only) For Apple-hosted and self-hosted downloads: - (void)storeDownloadFailed:(NSNotification*)notification
{
SKDownload *download = notification.rm_storeDownload; // Apple-hosted only
NSString *productIdentifier = notification.rm_productIdentifier;
SKPaymentTransaction *transaction = notification.rm_transaction;
NSError *error = notification.rm_storeError;
}
- (void)storeDownloadFinished:(NSNotification*)notification;
{
SKDownload *download = notification.rm_storeDownload; // Apple-hosted only
NSString *productIdentifier = notification.rm_productIdentifier;
SKPaymentTransaction *transaction = notification.rm_transaction;
}
- (void)storeDownloadUpdated:(NSNotification*)notification
{
SKDownload *download = notification.rm_storeDownload; // Apple-hosted only
NSString *productIdentifier = notification.rm_productIdentifier;
SKPaymentTransaction *transaction = notification.rm_transaction;
float progress = notification.rm_downloadProgress;
} Only for Apple-hosted downloads: - (void)storeDownloadCanceled:(NSNotification*)notification
{
SKDownload *download = notification.rm_storeDownload;
NSString *productIdentifier = notification.rm_productIdentifier;
SKPaymentTransaction *transaction = notification.rm_transaction;
}
- (void)storeDownloadPaused:(NSNotification*)notification
{
SKDownload *download = notification.rm_storeDownload;
NSString *productIdentifier = notification.rm_productIdentifier;
SKPaymentTransaction *transaction = notification.rm_transaction;
} ###Refresh receipt notifications (iOS 7+ only) - (void)storeRefreshReceiptFailed:(NSNotification*)notification;
{
NSError *error = notification.rm_storeError;
}
- (void)storeRefreshReceiptFinished:(NSNotification*)notification { } ##Receipt verification RMStore doesn't perform receipt verification by default but provides reference implementations. You can implement your own custom verification or use the reference verifiers provided by the library. Both options are outlined below. For more info, check out the wiki. ###Reference verifiers RMStore provides receipt verification via - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
const BOOL iOS7OrHigher = floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_6_1;
_receiptVerifier = iOS7OrHigher ? [[RMStoreAppReceiptVerifier alloc] init] : [[RMStoreTransactionReceiptVerifier alloc] init];
[RMStore defaultStore].receiptVerifier = _receiptVerifier;
// Your code
return YES;
} If security is a concern you might want to avoid using an open source verification logic, and provide your own custom verifier instead. ###Custom verifier RMStore delegates receipt verification, enabling you to provide your own implementation using the - (void)verifyTransaction:(SKPaymentTransaction*)transaction
success:(void (^)())successBlock
failure:(void (^)(NSError *error))failureBlock; Call You will also need to set the ##Downloading content RMStore automatically downloads Apple-hosted content and provides a delegate for a self-hosted content. ###Apple-hosted content Downloadable content hosted by Apple ( RMStore will notify that a transaction finished or failed only after all of its downloads have been processed. If you use blocks, they will called afterwards as well. The same applies to restoring transactions. ###Self-hosted content RMStore delegates the downloading of self-hosted content via the optional - (void)downloadContentForTransaction:(SKPaymentTransaction*)transaction
success:(void (^)())successBlock
progress:(void (^)(float progress))progressBlock
failure:(void (^)(NSError *error))failureBlock; Call ##Transaction persistence RMStore delegates transaction persistence and provides two optional reference implementations for storing transactions in the Keychain or in For more info, check out the wiki. ##Requirements RMStore requires iOS 5.0 or above and ARC. ##Roadmap RMStore is in initial development and its public API should not be considered stable. Future enhancements will include: ##License Copyright 2013-2014 Robot Media SL Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论