Re: Background session and progress
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