2

I am currently working on an app which allows users to purchase downloadable content by Hosted by Apple, so far my code works in terms of the user can purchase and the download completes OK and the file is intact.

However I want to display to the user the progress of the download as some of the files are quite large but I am finding that the SKDownload.progress runs to around 60% or 80% and then suddenly stops.

In my code I am doing the following:

- (void)paymentQueue:(SKPaymentQueue *)queue updatedDownloads:(NSArray *)downloads
{
    for (SKDownload* download in downloads)
    {
        switch (download.downloadState)
        {
                // The content is being downloaded. Let's provide a download progress to the user
            case SKDownloadStateActive:
            {
                self.status = IAPDownloadInProgress;
                self.purchasedID = download.transaction.payment.productIdentifier;
                self.downloadProgress = download.progress*100;
                NSLog(@"progress: %f", download.progress);
                NSLog(@"%f remaining", download.timeRemaining);

                [[NSNotificationCenter defaultCenter] postNotificationName:IAPPurchaseNotification object:self];
            }
                break;

But when I check the logs it shows the progress but stops here:

2015-02-23 18:59:20.122 AppName[1514:224651] progress: 0.800000
2015-02-23 18:59:20.123 AppName[1514:224651] 0.715862 remaining

I'm also showing a progress label to the user and from a user perspective when watching the download you would think its actually not downloaded when the last figure you see is 60 or 80%

Has anyone got any tips on this or is it perhaps a bug?

Thanks Aaron

MonkeyBlue
  • 2,234
  • 6
  • 31
  • 41
  • What are you expecting to happen? Is the content actually completing the download (as determined by other notifications and/or testing it in your app)? – Brad Brighton Feb 23 '15 at 21:43
  • Hi Brad, we are basically showing a UILabel progress to the user i.e. Downloading 5%, 10% and so on however when we click download the progress increments correctly but always finishes up between 60 - 80% so from a user view you would think its actually a broken download as during tests the average increment of the progress is around 4%. We are currently testing this in Sandbox at the moment also. – MonkeyBlue Feb 24 '15 at 11:15
  • If it's completing successfully (and it sounds like it is), don't rely on the progress notify to change your UI. Appropriately update to "Downloaded", "100%", etc. when you receive the "completion" notification. – Brad Brighton Feb 24 '15 at 17:09
  • I start to download a large file. SKDownload.progress works well, proceeding in 1% increments, up until about 0.8, after which my updatedDownloads: method stops getting called and so my download progress UI appears to freeze at 80%. Meanwhile, the file continues to download in the background and after about 5 mins, updatedDownloads: is called again and everything proceeds as normal. – Stewart Macdonald Apr 04 '15 at 05:14
  • I'm experiencing the exact same problem @smacdonald. Did you have any luck solving it? Was it a problem once you submitted to the App Store? – Dave Jun 02 '15 at 12:02
  • 1
    @Dave - I never sorted it out. I changed my app's business model and got rid of in-app purchases because downloading a 600MB IAP was just too unreliable for me. – Stewart Macdonald Jun 02 '15 at 22:59
  • @Dave I never got to the bottom of it but just had the assumption in production it would work better, we are due to submit the app to Apple very soon so I'll update back here after then – MonkeyBlue Jun 04 '15 at 11:47
  • Thanks @smacdonald, MonkeyBlue, due to submit soon myself soon. I'll report back also. – Dave Jun 04 '15 at 20:57
  • @Dave, MonkeyBlue: So what are your production experience? Does it work better in production? – Rasto Dec 25 '15 at 16:57
  • 1
    @drasto Yes. No problems reported in production. – Dave Dec 28 '15 at 15:30
  • @Dave Thank you Dave. Most helpful information. – Rasto Dec 30 '15 at 19:00

0 Answers0