Auto-Renewable Subscriptionsメモ

iOS 自動継続課金について

 

iOS7についてのレシート情報の調べ方はWebにいろいろ載ってたけど

iOS6がいまいち載ってなかったので

iOS6でのレシート情報の調べ方

if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_6_1) {

        // iOS 6.1 or earlier.

        NSData *testR = [Base64 decode:receiptString];

        NSLog(@"testR --> %@", testR);

        NSInteger status = [self verifyReceipt:testR sharedSecret:SHARED_SECRETNO];

 

        if (status == 0) {

            // 購入処理成功したことを通知する

        }

        else {

            // 購入処理エラーを通知する

        }

    }

    else {

        NSURL *receiptURL = [[NSBundle mainBundle] appStoreReceiptURL];

        NSLog(@"receiptURL -> %@", receiptURL);

        BOOL result = verifyReceiptAtPath([receiptURL path]);

        if (result == YES) {

            NSDictionary *dict = dictionaryWithAppStoreReceipt([receiptURL path]);

            NSLog(@"%@", dict);

 

            int status = [self savePurchaseInfo:dict];

            

            if (status == 0) {

                // 購入処理成功

            }

            else {

                // 購入処理エラー

            }

        }

    }

}

 

実装以外にもいろいろめんどうなんすよ

(´・ω;;;;;;テストとかテストとかテストとか.....申請とか申請とか....

参考

http://knowledge.kronos-jp.net/payment/yue-e-ke-jinmoderu-auto-renewable-subscriptions

http://umenon.com/2013/12/13/auto-renewable-subscriptions-not-recommended/