Ios 应用内购买速度非常慢

Ios 应用内购买速度非常慢,ios,iphone,ipad,in-app-purchase,Ios,Iphone,Ipad,In App Purchase,我的应用程序中有应用程序内工作购买,它们只是一次性非消费品购买。它们完全可以工作,甚至可以在应用商店中实时实现。 然而,在看似随机的时间,当用户试图从苹果购买产品时,响应速度非常慢,比如在100Mbps网络或LTE/3G网络上,通过Wi-Fi的响应时间大约为30秒以上。这似乎与连通性无关,只是苹果的反应需要这么长时间 以下是创建此提示并处理响应的基本代码: // User has decided to buy a sticker pack - (void) promptToBuyPack:(St

我的应用程序中有应用程序内工作购买,它们只是一次性非消费品购买。它们完全可以工作,甚至可以在应用商店中实时实现。 然而,在看似随机的时间,当用户试图从苹果购买产品时,响应速度非常慢,比如在100Mbps网络或LTE/3G网络上,通过Wi-Fi的响应时间大约为30秒以上。这似乎与连通性无关,只是苹果的反应需要这么长时间

以下是创建此提示并处理响应的基本代码:

// User has decided to buy a sticker pack
- (void) promptToBuyPack:(StickerPack *)pack {
    if([SKPaymentQueue canMakePayments]) {
        if([products valueForKey:pack.packID]) {
            SKPayment *payment = [SKPayment paymentWithProduct:[products valueForKey:pack.packID]];
            [[SKPaymentQueue defaultQueue] addPayment:payment];
        }
        else {
            nlog(@"User attempted to buy a pack that iTunes does not recognize");
        }

    }
    else {
        UIAlertView *a = [[UIAlertView alloc] initWithTitle:@"Can not make purchases" message:@"Your device does not have purchases enabled. Please enable them in order to proceed" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
        [a show];
    }
}



- (void) grantProductAccess:(NSString *)productIdentifier {
    // Store purchase in user defaults
    nlog(@"Bought product: %@", productIdentifier);
    [[NSUserDefaults standardUserDefaults] setValue:[NSNumber numberWithBool:YES] forKey:productIdentifier];
    [[NSUserDefaults standardUserDefaults] synchronize];
}

- (void) tellUserPurchaseIsComplete {
    UIAlertView *a = [[UIAlertView alloc] initWithTitle:@"Purchase Complete" message:@"Your pack is now unlocked, Enjoy!" delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil];
    [a show];
    [a release];
}

- (void) paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions {
    for(SKPaymentTransaction *transaction in transactions) {
        BOOL canFinishTransaction = NO;
        switch (transaction.transactionState) {
            case SKPaymentTransactionStatePurchased:
                canFinishTransaction = YES;
                [self grantProductAccess:transaction.payment.productIdentifier];
                [self tellUserPurchaseIsComplete];
                if(iPad)
                    [FlurryAPI logEvent:[NSString stringWithFormat:@"Purchased %@ on iPad",transaction.payment.productIdentifier]];
                else
                    [FlurryAPI logEvent:[NSString stringWithFormat:@"Purchased %@ on iPod",transaction.payment.productIdentifier]];
                break;
            case SKPaymentTransactionStateFailed:
                nlog(@"Transactin failed");
                canFinishTransaction = YES;
                break;
            case SKPaymentTransactionStateRestored:
                nlog(@"SKPaymentTransactionStateRestored");
                canFinishTransaction = YES;
                [self grantProductAccess:transaction.originalTransaction.payment.productIdentifier];
                break;
            default:
                nlog(@"SKPaymentTransactionDefault");
                break;
        }

        // Remove from payment queue
        if(canFinishTransaction)
            [[SKPaymentQueue defaultQueue] finishTransaction:transaction];
    }
}

你找到问题的原因/解决方案了吗?我也遇到了同样的问题。我还没有完全确定问题所在,但我在下一个版本的应用程序中所做的是将整个商店系统切换到使用MKStoreKit。我不知道是什么导致了这些问题,也不知道这是否包含修复。实际上,我只是“重写”了所有内容,所以希望它现在能工作。我们正在讨论这个应用程序,所以我会报告它是否有用。这个问题似乎已经用MKStoreKit解决了!我知道这是一个老问题,但你能在答案中发布部分代码吗。我目前正在使用存储工具包,它非常慢,有时甚至无法加载。这里的情况也一样。顺便说一句,mkstorekit使用storekit,所以不知道为什么它对任何人都有帮助。