对某些用户而言,下载iAP托管内容会陷入SKDownloadStateWaiting [英] Downloading iAP Hosted Content gets stucks on SKDownloadStateWaiting for some users

查看:53
本文介绍了对某些用户而言,下载iAP托管内容会陷入SKDownloadStateWaiting的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

标题说的差不多.该代码对于我在沙盒环境中的所有开发设备以及我的大多数用户而言都可以正常工作.但是,有些用户报告说,即使整个晚上,下载过程也不会超出等待状态(SKDownloadStateWaiting).一些人确实尝试了几次下载后才开始下载(完全关闭该应用程序并通过恢复购买"功能),因此看起来确实是完全随机的.

Pretty much what the title says. The code works fine for all my development devices in the sandbox environment and for a majority of my users. However, there are some users reporting that the download process doesn't move beyond the waiting state (SKDownloadStateWaiting), even when left through the night. Some do manage to get the download started after a few tries (closing the app completely and going through restore purchases feature), so it does look to be completely random.

这是我用来管理下载的代码:

Here is the code I'm using to manage downloading:

- (void)paymentQueue:(SKPaymentQueue *)queue updatedDownloads:(NSArray *)downloads
{
    SKDownload *download = [downloads objectAtIndex:0];
    SKPaymentTransaction *transaction = download.transaction;

    // Keep track of download status
    switch (download.downloadState) {
        case SKDownloadStateActive:
            // Present time remaining and percentage
            break;

        case SKDownloadStateWaiting:
            // Present "Waiting..." label
            break;

        case SKDownloadStateFinished:
            [self purchaseNonconsumableAtURL:download.contentURL forProductIdentifier:productIdentifier];
            [[SKPaymentQueue defaultQueue] finishTransaction:transaction];
            break;

        case SKDownloadStateFailed:
            [[SKPaymentQueue defaultQueue] finishTransaction:transaction];
            break;

        case SKDownloadStateCancelled:
            [[SKPaymentQueue defaultQueue] finishTransaction:transaction];
            break;

        default:
            break;
    }
}

任何帮助将不胜感激.

推荐答案

您可以尝试通过调用

[[SKPaymentQueue defaultQueue] startDownloads:[NSArray arrayWithObject:download]];

当我的应用程序尝试恢复较早的交易时,始终会获得处于永久等待"状态的下载.我编辑了paymentQueueupdatedDownloads函数,以便每当调用处于等待状态的下载文件时,它将把该下载文件传递给startDownloads,这似乎可以解决此问题.

My application would always get downloads that were in a permanent "waiting" state when it attempted to resume earlier transactions. I edited the paymentQueue updatedDownloads function so that whenever it's called with a download that's in a waiting state, it will pass that download to startDownloads, and this seemed to fix the issue.

这篇关于对某些用户而言,下载iAP托管内容会陷入SKDownloadStateWaiting的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆