2

アプリが iTunes によって拒否されました。

その理由は:</p>

購入ボタンをタップした後、アプリはアプリ内購入プロセスを終了するためのパスワード ウィンドウを開始せず、「待機中」というメッセージを表示するだけで何も起こりません。

購入ダイアログがあるということですが、購入ボタンをタップするとパスワードウィンドウが表示されません。

パスワード ウィンドウの初期化は私の制御下にありません。どうすればよいですか?

これが私のコードです:

-(void)buy:(NSString*)type
{
    buyType = type;
    //judge whether can buy product
    if ([SKPaymentQueue canMakePayments]) {
        NSLog(@"can buy");
        [self RequestProductData];
    }else{
        UIAlertView *alerView =  [[UIAlertView alloc] initWithTitle:@"Alert"
                                                            message:@"You can‘t purchase in app store(不允许应用程序内购买)"
                                                           delegate:nil cancelButtonTitle:NSLocalizedString(@"Close(关闭)",nil) otherButtonTitles:nil];

        [alerView show];
        [alerView release];

    }
}

-(bool)CanMakePay
{
    return [SKPaymentQueue canMakePayments];
}

-(void)RequestProductData
{
    NSSet *nsset = [NSSet setWithObject:buyType];
    SKProductsRequest *request=[[SKProductsRequest alloc] initWithProductIdentifiers: nsset];
    request.delegate=self;
    [request start];
}
//<SKProductsRequestDelegate> 
- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response{

    NSArray *myProduct = response.products;
    // populate UI
    for(SKProduct *product in myProduct){
        SKPayment *payment = [SKPayment paymentWithProduct:product];
        [[SKPaymentQueue defaultQueue] addPayment:payment];
    }
    [request autorelease];   
}

//alert error
- (void)request:(SKRequest *)request didFailWithError:(NSError *)error{
    UIAlertView *alerView =  [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Alert",NULL) message:[error localizedDescription]
                                                       delegate:nil cancelButtonTitle:NSLocalizedString(@"Close",nil) otherButtonTitles:nil];
    [alerView show];
    [alerView release];
}

-(void) requestDidFinish:(SKRequest *)request
{

}

-(void) PurchasedTransaction: (SKPaymentTransaction *)transaction{
    NSArray *transactions =[[NSArray alloc] initWithObjects:transaction, nil];
    [self paymentQueue:[SKPaymentQueue defaultQueue] updatedTransactions:transactions];
    [transactions release];
}

//<SKPaymentTransactionObserver> 
//----listen to the purchase result
//
- (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions
{
    for (SKPaymentTransaction *transaction in transactions)
    {
        switch (transaction.transactionState)
        {
            case SKPaymentTransactionStatePurchased://purchase ok
                [self completeTransaction:transaction];
                [[transaction payment] quantity];
                NSLog(@"%@",[[NSString alloc] initWithData:transaction.transactionReceipt encoding:NSUTF8StringEncoding ]);
                NSLog(@"transaction id:%@",[transaction transactionIdentifier]);
                break;
            case SKPaymentTransactionStateFailed:
                [self failedTransaction:transaction];
                NSLog(@"-----交易失败 --------");
                break;
            case SKPaymentTransactionStateRestored:
                [self restoreTransaction:transaction];
            case SKPaymentTransactionStatePurchasing:  
                break;
            default:
                break;
        }
    }
}
- (void) completeTransaction: (SKPaymentTransaction *)transaction
{
    [[SKPaymentQueue defaultQueue] finishTransaction: transaction];

}

-(void)recordTransaction:(NSString *)product{
}

//
-(void)provideContent:(NSString *)product{
}

- (void) failedTransaction: (SKPaymentTransaction *)transaction{
    [[SKPaymentQueue defaultQueue] finishTransaction: transaction];  
}
-(void) paymentQueueRestoreCompletedTransactionsFinished: (SKPaymentTransaction *)transaction{

}

- (void) restoreTransaction: (SKPaymentTransaction *)transaction

{

}

-(void) paymentQueue:(SKPaymentQueue *) paymentQueue restoreCompletedTransactionsFailedWithError:(NSError *)error{

}
4

0 に答える 0