• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Background session and progress
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Background session and progress


  • Subject: Re: Background session and progress
  • From: Rick Mann <email@hidden>
  • Date: Mon, 09 Feb 2015 13:45:08 -0800

Ah, thank you. I didn't realize tasks had their own delegates, too.

> On Feb 9, 2015, at 13:25 , Dan Vinegrad <email@hidden> wrote:
>
> Hi Rick,
>
> You can implement the following NSURLSessionTaskDelegate method in order to receive progress updates about the upload task while your app is running:
>
> - (void)URLSession:(NSURLSession *)session
>               task:(NSURLSessionTask *)task
>    didSendBodyData:(int64_t)bytesSent
>     totalBytesSent:(int64_t)totalBytesSent
> totalBytesExpectedToSend:(int64_t)totalBytesExpectedToSend
>
> https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSURLSessionTaskDelegate_protocol/index.html#//apple_ref/occ/intfm/NSURLSessionTaskDelegate/URLSession:task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend:
>
> You can also poll for progress at any times via the countOfBytesSent and countOfBytesExpectedToSend properties on NSURLSessionTask. There are equivalent properties / delegate methods for download tasks as well.
>
> Hope this helps,
> Dan
>
>> On Feb 9, 2015, at 1:08 PM, Rick Mann <email@hidden> wrote:
>>
>> I was hoping to switch from the old networking code to using background NSURLSessions for my app's upload task. I wanted to use a single background upload task for uploading when my app is running, and to ensure that it continues to upload in the background if the app is killed.
>>
>> But my app displays upload progress, and I don't see any way to get the progress from an upload (or a download, for that matter).
>>
>> Do I have to to have the mess of uploading "normally" while my app is running, and then, during app termination, re-establish all my uploads as background uploads to let it keep going? This seems excessively burdensome.
>>
>>
>> --
>> Rick Mann
>> email@hidden
>>
>>
>>
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Macnetworkprog mailing list      (email@hidden)
>> Help/Unsubscribe/Update your Subscription:
>>
>> This email sent to email@hidden
>


--
Rick Mann
email@hidden



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


References: 
 >Background session and progress (From: Rick Mann <email@hidden>)
 >Re: Background session and progress (From: Dan Vinegrad <email@hidden>)

  • Prev by Date: Re: Background session and progress
  • Next by Date: NSURLSession and cellular access
  • Previous by thread: Re: Background session and progress
  • Next by thread: NSURLSession and cellular access
  • Index(es):
    • Date
    • Thread