3

iOS 7 用にアプリケーションを更新する予定で、IAP を使用していますが、xcode 5 で次のエラーが表示されます。

transactionreceipt は非推奨です: iOS 7 で最初に非推奨になりました

ここに私のコードがあります:

// saves a record of the transaction by storing the receipt to disk
    - (void)recordTransaction:(SKPaymentTransaction *)transaction
    {
        if ([transaction.payment.productIdentifier isEqualToString:kProductIdentifier])
        {
            // save the transaction receipt to disk
            [[NSUserDefaults standardUserDefaults] setValue:transaction.transactionReceipt forKey:@"proUpgradeTransactionReceipt"];
            [[NSUserDefaults standardUserDefaults] synchronize];
        }
    }

この問題を解決するにはどうすればよいですか?

//編集済み:

AndreyMan の回答を使用しましたが、何も起こらず、コンパイラから APP:requestProductData END メッセージが表示されました

- (void)requestProductData
{
       [NSThread sleepForTimeInterval:2];

    NSLog(@"IN-APP:requestProductData");
    SKProductsRequest *request= [[SKProductsRequest alloc]
                                 initWithProductIdentifiers: [NSSet setWithObject: @"com.compony.product"]];
    request.delegate = self;
    [request start];

    NSLog(@"IN-APP:requestProductData END");


}

そして、これらのメッセージが表示されます:

2013-10-08 14:26:21.400 Arta[1138:60b] Purchasing... 2013-10-08 14:26:28.380 Arta[1138:60b] Unknown Reason. 2013-10-08 14:26:28.383

Arta[1138:60b] 購入に失敗しました...

- (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions
{
    for (SKPaymentTransaction *transaction in transactions)
    {
        switch (transaction.transactionState)
        {
            case SKPaymentTransactionStatePurchased:
                [self completeTransaction:transaction];
                NSLog(@"Purchase compelete...");
                break;
            case SKPaymentTransactionStateFailed:
                [self failedTransaction:transaction];
                NSLog(@"Purchase faild...");
                break;
            case SKPaymentTransactionStateRestored:
                [self restoreTransaction:transaction];
                NSLog(@"Restore compelete...");
                break;
            case SKPaymentTransactionStatePurchasing:
                NSLog(@"Purchasing...");
                break;
            default:
                break;
        }
    }
}




- (void)failedTransaction:(SKPaymentTransaction *)transaction
{
    if (transaction.error.code != SKErrorPaymentCancelled)
    {
        // error!
        [self finishTransaction:transaction wasSuccessful:NO];
        if (transaction.error.code == SKErrorClientInvalid) {
        }
        else if (transaction.error.code == SKErrorPaymentInvalid) {

        }
        else if (transaction.error.code == SKErrorPaymentNotAllowed) {
        }
        else if (transaction.error.code == SKErrorPaymentCancelled) {
            // [self showAlert:@"In-App Purchase" withMessage:@"This device is not allowed to make the payment."];
            NSLog(@"User Cancellation.");
        }
        else {
            // SKErrorUnknown
            NSLog(@"Unknown Reason.");
        }
    }
    else  {
        // this is fine, the user just cancelled, so don’t notify
        [[SKPaymentQueue defaultQueue] finishTransaction:transaction];
    }
}
4

1 に答える 1

3

何かのようなもの:

NSURL *receiptUrl = [[NSBundle mainBundle] appStoreReceiptURL];
NSData *receipt;
receipt = [NSData dataWithContentsOfURL:receiptUrl];
于 2013-09-26T10:44:05.417 に答える