Apple では、すべてのレシートをサーバーに保存して確認することをお勧めします。
(また)
RMStore は、トランザクションの永続性を委任し、キーチェーンまたは NSUserDefaults にトランザクションを格納するための 2 つのオプションの参照実装を提供します。トランザクションを実装したり、ライブラリが提供する参照実装を使用したり、非消耗品や自動更新サブスクリプションの場合は、レシートから直接トランザクションを取得したりできます。
-(void) startProductPurchase{
[[RMStore defaultStore] requestProducts:[NSSet setWithArray:_products] success:^(NSArray *products, NSArray *invalidProductIdentifiers) {
_productsRequestFinished = YES;
NSLog(@"Product Request Finished");
[self buyApplication:products];
} failure:^(NSError *error) {
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Products Request Failed", @"")
message:error.localizedDescription
delegate:nil
cancelButtonTitle:NSLocalizedString(@"OK", @"")
otherButtonTitles:nil];
[alertView show];
}];
受信通知の更新 (iOS 7 以降のみ)
- (void)storeRefreshReceiptFailed:(NSNotification*)notification;
{
NSError *error = notification.rm_storeError;
}
- (void)storeRefreshReceiptFinished:(NSNotification*)notification { }
領収書の確認
RMStore は既定では受信確認を実行しませんが、参照実装を提供します。独自のカスタム検証を実装するか、ライブラリが提供する参照検証ツールを使用できます。
両方のオプションの概要を以下に示します。詳細については、wiki を参照してください。
参照検証者
RMStore は、RMStoreAppReceiptVerificator (iOS 7 以降の場合) および RMStoreTransactionReceiptVerificator (iOS 6 以前の場合) を介してレシート検証を提供します。それらのいずれかを使用するには、RMStore/Optional から対応するファイルをプロジェクトに追加し、起動時にベリフィケーター デリゲート (receiptVerificator) を設定します。例えば:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
const BOOL iOS7OrHigher = floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_6_1;
_receiptVerificator = iOS7OrHigher ? [[RMStoreAppReceiptVerificator alloc] init] : [[RMStoreTransactionReceiptVerificator alloc] init];
[RMStore defaultStore].receiptVerificator = _receiptVerificator;
// Your code
return YES;
}
詳細については、以下のリンクをたどってください。
iOS アプリ内購入が簡単に
アプリ内購入用の軽量 iOS ライブラリ
いらっしゃいませ。
それがあなたを助けることを願って.............