0

サンドボックス モードでアプリ内購入をテストしていますが、購入しようとすると「このアプリ内購入は既に購入されています」というメッセージが表示され続けます。 . アプリを強制終了して再起動しようとしましたが、引き続きこのメッセージが表示されます。これは Xcode Objective C のバグですか、それとも iOS のバグですか? この問題を解決するための回答やガイダンスをいただければ幸いです。よろしくお願いします。

更新: SKPayment のコード

- (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions{
for(SKPaymentTransaction *transaction in transactions){
    switch(transaction.transactionState){
        case SKPaymentTransactionStatePurchasing: NSLog(@"Transaction state -> Purchasing");
            //called when the user is in the process of purchasing, do not add any of your own code here.
            break;
        case SKPaymentTransactionStatePurchased:
            //this is called when the user has successfully purchased the package (Cha-Ching!)
            [self doRemoveAds:validProduct];
            //you can add your code for what you want to happen when the user buys the purchase here, for this tutorial we use removing ads
            [[SKPaymentQueue defaultQueue] finishTransaction:transaction];
            NSLog(@"Transaction state -> Purchased");
            break;
        case SKPaymentTransactionStateRestored:
            NSLog(@"Transaction state -> Restored");
            [self doRemoveAds:validProduct];

            //add the same code as you did from SKPaymentTransactionStatePurchased here
            break;
        case SKPaymentTransactionStateFailed:
            //called when the transaction does not finish
            if(transaction.error.code == SKErrorPaymentCancelled){
                NSLog(@"Transaction state -> Cancelled");
                //the user cancelled the payment ;
            }
            [[SKPaymentQueue defaultQueue] finishTransaction:transaction];

            break;
    }
4

0 に答える 0