GithubHelp home page GithubHelp logo

thibaultcha / tcblobdownload Goto Github PK

View Code? Open in Web Editor NEW
920.0 920.0 183.0 1.45 MB

Concurrent large files downloads for iOS

Home Page: http://cocoadocs.org/docsets/TCBlobDownload

License: MIT License

Objective-C 98.92% Ruby 1.08%

tcblobdownload's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tcblobdownload's Issues

Add Cookie?

Is there an easy way of adding a cookie to the download request. We have an auth cookie in our app.

Thanks!

Cannot build this project

I download this project from github. Did a build and I get these errors. I am using Xcode 5.1.1 with iOS 7.1, OSX 10.9.4. What did I miss?

/Users/beanbob/Library/Developer/Xcode/DerivedData/TCBlobDownloadExample-gnfygdwfjhxvaobvtfrjhoycpfpn/Build/Intermediates/TCBlobDownload.build/Debug-iphonesimulator/Documentation.build/Script-C358A5EA18BFE46200F4C317.sh: line 12: /usr/local/bin/appledoc: No such file or directory
mv: rename /Users/beanbob/Downloads/TCBlobDownload-master/TCBlobDownload/Docs/docset to /Users/beanbob/Downloads/TCBlobDownload-master/TCBlobDownload/Docs/TCBlobDownload.docset: No such file or directory
zip warning: name not matched: /Users/beanbob/Downloads/TCBlobDownload-master/TCBlobDownload/Docs/TCBlobDownload.docset

zip error: Nothing to do! (/Users/beanbob/Downloads/TCBlobDownload-master/TCBlobDownload/Docs/TCBlobDownloadDocset.zip)
Command /bin/sh emitted errors but did not return a nonzero exit code to indicate failure

screen shot 2014-09-14 at 1 45 35 pm

Download gzip file error

When the downloading finished , I will do an md5 calculate to check the file.
Every time I stop and resume downloading a gzip file, the md5 code is error, and if the downloading finished without stop, the md5 code is always correct.

Roadmap Ideas

What do you think about:

  1. pause/resume downloads
  2. possibility to download files using an ios 7 background task? helpful for very large files when you don't want to have the app open all the time

Bug found in connection:didReceiveResponse:

Hi Thibault, thanks for the project, I've been using it for a while and it's wonderful.

Recently I've noticed some suspicious crashes happening and I'm able to narrow it down to the callback block of startDownloadWithURL:customPath:firstResponse:progress:error:complete:method. Turns out the totalLength parameter in progressBlock sometimes returns the maximum value of UInt64, so when I assign it to a 64-bit NSNumber, it causes a segmentation fault.

on Line 205 of TCBlobDownload.m I found:

self.expectedDataLength = self.receivedDataLength + [response expectedContentLength];

the expectedContentLength property of NSURLResponse returns -1 if there is no expectation that can be arrived, at the same time if I pause and resume a download, sometimes receivedDataLength could be 0 (not sure why), so here you could be assigning minus value to expectedDataLength which is a uint64_t. I suggest to check the value before the assignment.

Meanwhile,I'm using TCBlobDownload in my swift project at the moment. I should take your advice and switch to the newest swift version. Again thanks for your hard work :)

self.file seekToEndOfFile Exception

My app crash on start seekToEndOfFile.

The log is like that:
image

Or like that:
image

Maybe you should catch this Exception or something else

File is depends on devices environment, so it may be failes

Download in the background process

If the user locked the screen the download is stopped. When I searched about it I found in Apple's documentation it recommends using NSURLSession instead of NSURLConnection here apple docs.

Is there a way to prevent the download from stopping when the app enters background. Or do I have to edit the implementation and use NSURLSession.

Download Paused

I am having this "TCBlobDownloader 0x1137e460 went isFinished=YES without being started by the queue it is in" and download is paused.

Add unit tests

Extend the actual existing tests and integrate Travis-CI and eventually some coverage.

how to remove download part file?

Thanks for this useful library. I have a question. In some cases, some downloads are not finished. After the App is restarted, I cannot get TCBlobDownloader instance, so have no way to call cancelDownloadAndRemoveFile. Then how to remove the download part file?

Thread Management Bug

Hi, Thanks for your project first. It is good to use, but i've found a thread management bug in the project. As I want to download the files one by one, I use - (void)setMaxConcurrentDownloads:(NSInteger)maxConcurrent function and pass 1 as parameter. But after that , the application can only download the first file successfully, which means the rest files won't be download at all! I looked into your code carefully ,and found a thread management bug. You use [runLoop run]; to stop the thread from stopping immediately, but never called CFRunLoopStop(); to stop it. That means the thread will never be released. You can call CFRunLoopStop(); to stop the thread in finishOperation();
By the way, I tested it on ios8.
Thanks for your wonderful work again.

Pause and Resume Functionality

I have added pause and resume feature for multiple file downloads page. Can it be added to the build? Here's code snippet

@Property (nonatomic, strong) NSMutableArray *currentDownloadsURL;
static int cellIntVal = 0;

_currentDownloadsURL = [NSMutableArray new];

  • (void)dismiss:(id)sender
    {

    [[TCBlobDownloadManager sharedInstance] cancelAllDownloadsAndRemoveFiles:YES];

    //remove all files from cache dir otherwise download never completes next time around if it was paused and closed
    [FCFileManager removeItemAtPath:[NSHomeDirectory() stringByAppendingString:@"/Library/Caches"]];
    [FCFileManager createDirectoriesForPath:[NSHomeDirectory() stringByAppendingString:@"/Library/Caches"]];

    [self dismissViewControllerAnimated:YES completion:nil];
    }

  • (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
    {
        NSLog(@"alertView - buttonIndex: %d ...", buttonIndex);
        
        
        if (buttonIndex == 1)
        {
            NSString *urlString = [alertView textFieldAtIndex:0].text;
            
            TCBlobDownloader *download = [[TCBlobDownloader alloc] initWithURL:[NSURL URLWithString:urlString]
                                                                  downloadPath:kDownloadPath
                                                                      delegate:self];
            [self.currentDownloads addObject:download];
            [self.currentDownloadsURL addObject:urlString];
            
            [[TCBlobDownloadManager sharedInstance] startDownload:download];
        }
        
        //[self.tableView reloadSections:[NSIndexSet indexSetWithIndex:0] withRowAnimation:UITableViewRowAnimationAutomatic];
        
        [self.tableView reloadData];
        
    }

  • (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
    {

    cellIntVal = 0;
    cellIntVal = indexPath.row;

    UIActionSheet *popupQuery = [[UIActionSheet alloc] initWithTitle:@"What would you like to do?" delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil otherButtonTitles:@"Pause Download", @"Resume Download", @"Delete Download", nil];
    popupQuery.actionSheetStyle = UIActionSheetStyleBlackOpaque;
    popupQuery.tag = 700;
    [popupQuery showInView:self.view];

    [tableView deselectRowAtIndexPath:indexPath animated:NO];

    //refresh table
    [tableView reloadData];
    }

-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
//NSLog(@"Inside void actionSheet buttonIndex: %d ...", buttonIndex);

if (actionSheet.tag == 700)
{
    if (buttonIndex == 0)
    {
        //pause
        [self pauseDownload];
    }
    else if (buttonIndex == 1)
    {
        //resume
        [self resumeDownload];
    }
    else if (buttonIndex == 2)
    {
        //Delete
        [self deleteDownload];
    }
    else if (buttonIndex == 3)
    {
        //cancel action
    }

}//700

}

-(IBAction) pauseDownload
{
TCBlobDownloader *download = self.currentDownloads[cellIntVal];
[download cancelDownloadAndRemoveFile:NO];

UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:cellIntVal
                                                                                inSection:0]];
[cell.detailTextLabel setText:@"Paused"];

[self.tableView reloadData];

}

-(IBAction) resumeDownload
{

NSString *urlString = [self.currentDownloadsURL objectAtIndex:cellIntVal];

TCBlobDownloader *download = [[TCBlobDownloader alloc] initWithURL:[NSURL URLWithString:urlString]
                                                      downloadPath:kDownloadPath
                                                          delegate:self];

//remove old object and add this new second download
[self.currentDownloads removeObjectAtIndex:cellIntVal];
[self.currentDownloadsURL removeObjectAtIndex:cellIntVal];

[self.currentDownloads addObject:download];
[self.currentDownloadsURL addObject:urlString];

//start download
[[TCBlobDownloadManager sharedInstance] startDownload:download];

UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:cellIntVal
                                                                                 inSection:0]];
[cell.detailTextLabel setText:[self subtitleForDownload:download]];

[self.tableView reloadData];

}

-(IBAction) deleteDownload
{

TCBlobDownloader *download = self.currentDownloads[cellIntVal];
[download cancelDownloadAndRemoveFile:YES];

//remove old object and add this new second download
[self.currentDownloads removeObjectAtIndex:cellIntVal];
[self.currentDownloadsURL removeObjectAtIndex:cellIntVal];

UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:cellIntVal
                                                                                 inSection:0]];
[cell.detailTextLabel setText:[self subtitleForDownload:download]];

[self.tableView reloadData];

}

Can not multi download and direct link

Google Drive Download URL

Please help, I cannot download from Google Drive with a given url by Google Drive API.

Requested url:
https://doc-0s-1s-docs.googleusercontent.com/docs/securesc/drir90g4j3pvaif9fq0tld6v4l690pel/2up5t14otqmlosa6anifku6he3b54fce/1452744000000/03385602974198283278/03385602974198283278/0BwJCGF2rR5_9UUtvdUFrRl9HVm8?e=download&gd=true

And here is error:
Error Domain=com.thibaultcha.tcblobdownload Code=1 "Erroneous HTTP status code 401 (unauthorized)" UserInfo={NSLocalizedDescription=Erroneous HTTP status code 401 (unauthorized), TCBlobDownloadErrorHTTPStatusKey=401}

download speed is 0

when i run blow code ,log show download speed and remainingTime is 0,why?

TCBlobDownloadManager *sharedManager = [TCBlobDownloadManager sharedInstance];
    
    
    TCBlobDownloader *downloader =[sharedManager startDownloadWithURL:[NSURL URLWithString:@"http://ofqnohifh.bkt.clouddn.com/%E3%80%90%E9%98%BF%E5%8F%B6%E5%90%9B%E3%80%91%E6%81%8B%E7%88%B1%E5%BE%AA%E7%8E%AF%E4%B9%8B%E4%B8%89%E5%88%86%E9%92%9F%E5%B8%A6%E4%BD%A0%E6%B8%B8%E5%B2%B3%E9%98%B3.mp4"] customPath:nil firstResponse:^(NSURLResponse *response) {
        
    } progress:^(uint64_t receivedLength, uint64_t totalLength, NSInteger remainingTime, float progress) {
        
        NSLog(@"speed=%ld,remainingTime=%ld",downloader.speedRate,downloader.remainingTime);
        
    } error:^(NSError *error) {
        
    } complete:^(BOOL downloadFinished, NSString *pathToFile) {
        
    }];

Respect HTTP status codes

I think it would be a great imporvement if you would check the HTTP status codes in TCBlobDownload.m

connection:(NSURLConnection*)connection didReceiveResponse:(NSURLResponse *)response
{
_expectedDataLength = [response expectedContentLength];

    // checking for status error
    // errors are 4xx or higher
    // see: http://en.wikipedia.org/wiki/List_of_HTTP_status_codes
    NSHTTPURLResponse *res = (NSHTTPURLResponse *)response;
    int httpStatusCode = res.statusCode/100;

    if (httpStatusCode > 3) {
        __autoreleasing NSError *error = [NSError errorWithDomain:kErrorDomain
                                                             code:2
                                                         userInfo:@{NSLocalizedDescriptionKey:
                                                                        [NSString stringWithFormat:NSLocalizedString(@"HTTP error code %d (%@) ", @"HTTP error code {satus code} ({status code description})"), res.statusCode, [NSHTTPURLResponse localizedStringForStatusCode:res.statusCode]]}];
        TCLog(@"Download failed. Error - %@ %@",
              [error localizedDescription],
              [error userInfo][NSURLErrorFailingURLStringErrorKey]);
        if (self.errorBlock) {
            self.errorBlock(error);
        }
        if ([self.delegate respondsToSelector:@selector(download:didStopWithError:)]) {
            [self.delegate download:self didStopWithError:error];
        }

        [self cancelDownloadAndRemoveFile:NO];
    } else {
        if ([TCBlobDownload freeDiskSpace] < _expectedDataLength

I can send you a patch file if you want.

Markus

Bug with MultipleViewController alert tag

when you enter a link in the pop-up box on the multiple download page it still downloads all files. The tag to check buttons indexes are incorrect. This needs to be switched to

  • (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
    {
    NSLog(@"alertView - buttonIndex: %d ...", buttonIndex);

    if (buttonIndex == 1)
    {
    NSString *urlString = [alertView textFieldAtIndex:0].text;

    NSLog(@"urlString: %@ ...", urlString);
    
    TCBlobDownloader *download = [[TCBlobDownloader alloc] initWithURL:[NSURL URLWithString:urlString]
                                                          downloadPath:kDownloadPath
                                                              delegate:self];
    [self.currentDownloads addObject:download];
    
    [[TCBlobDownloadManager sharedInstance] startDownload:download];
    

    }
    if (buttonIndex == 2)
    {
    for (NSDictionary *downloadInfos in self.defaultDownloads)
    {
    TCBlobDownloader *download = [[TCBlobDownloader alloc] initWithURL:[NSURL URLWithString:downloadInfos[kURLKey]]
    downloadPath:kDownloadPath
    delegate:self];
    [download setFileName:downloadInfos[kNameKey]];
    [self.currentDownloads addObject:download];

        [[TCBlobDownloadManager sharedInstance] startDownload:download];
    }
    

    }

    [self.tableView reloadSections:[NSIndexSet indexSetWithIndex:0]
    withRowAnimation:UITableViewRowAnimationAutomatic];

}

TCBlobDownload--updating handlers/delegates

In my app, the view that initiates file downloads using TCBlobDownload is a child view that can be dismissed/dealloc'd. TCBlobDownload continues downloading the files in the background, which is great. However, when the download view is closed and reopened, I lose access to the handlers/delegate, which I need in order to continue updating progress bars in the UI. Is there a way to do this, currently? I tried directly accessing both the delegate and progression/completion properties of TCBlobDownload in order to update them, but these aren't made public. It would be nice if these could either be made public, or provide a method to update them after the download has begun.

Download Speed and Time Left

Hi!
I'd like to request a feature which I think would be really nice for lots of people:
The current download speed and an estimated value in seconds how long the download could take.

HTTP error code

Hi,
first, its a great job!

second, how i can solve for a 416 http when starting a download ?

tnks

Enhancements

  • Expose the error domain and error keys
  • Fix went isFinished before being executed by the queue it is in -> Fix the mess in notifyFromCompletionWithSuccess: (don't change isFinished if not started)
  • Exclude the hardware category from documentation
  • Release 2.1.0

  • Improve the tests
    • Coverage
    • More robust tests (cancelAllOperations, dependent downloads...)
    • Use httpbin
    • XCT expectations? This is a legacy library so I'm not sure about relying on Xcode 6

request time out

Hi,when i download files,some request time out.
The error info is :
Error Domain=NSURLErrorDomain Code=-1001 "time out。" UserInfo={NSUnderlyingError=0x137d4c2b0 {Error Domain=kCFErrorDomainCFNetwork Code=-1001 "time out。" UserInfo={NSErrorFailingURLStringKey=http://mlintest.midea.com.cn:8080/wdxieyi/d.do?id=201605061719455c55489e9c26bb44c17e2c&cid=201605061712289ef397434387e0c45486cb&sid=TyvjNMPfPJu8r51sm9ENHQ==, NSErrorFailingURLKey=http://mlintest.midea.com.cn:8080/wdxieyi/d.do?id=201605061719455c55489e9c26bb44c17e2c&cid=201605061712289ef397434387e0c45486cb&sid=TyvjNMPfPJu8r51sm9ENHQ==, _kCFStreamErrorCodeKey=-2102, _kCFStreamErrorDomainKey=4, NSLocalizedDescription=time out。}}, NSErrorFailingURLStringKey=http://mlintest.midea.com.cn:8080/wdxieyi/d.do?id=201605061719455c55489e9c26bb44c17e2c&cid=201605061712289ef397434387e0c45486cb&sid=TyvjNMPfPJu8r51sm9ENHQ==, NSErrorFailingURLKey=http://mlintest.midea.com.cn:8080/wdxieyi/d.do?id=201605061719455c55489e9c26bb44c17e2c&cid=201605061712289ef397434387e0c45486cb&sid=TyvjNMPfPJu8r51sm9ENHQ==, _kCFStreamErrorDomainKey=4, _kCFStreamErrorCodeKey=-2102, NSLocalizedDescription=time out。}

But,when i download the single file,it's ok.why?

Return TCBlobDownload

Hey,

Just as a thought it would be good if you could return the TCBlobDownload object from the TCBlobDownloadManager startDownloadWithURL methods so it's possible to store them and call cancelDownloadAndRemoveFile later.

At the moment it is just returning void so I'm sure if there would be any issues in doing this.

Cheers.

iOS 10 - crash in start method

I experienced random crashes in start method in iOS 10:

[runLoop run];

Are this library supporting iOS 10? Are you planning iOS 10 update?

resume download when app is reopened after several hours.

Hello,
First of all I want to say that your work is awesome.
I am currently facing an issue while changing the request timeout in "TCBlobDownload.m", currently the (kDefaultRequestTimeout = 30) this is set to 30 seconds and I have seen that if the download was in progress and the app was minimized than the download will work for 30 seconds and after that the request timeout error will appear. when i change this timeout to 86400 (24 hours) than it only downloads for 4 minutes after the app is minimized and than request time out occurs.

I want to make the download to be active for 24 hours and after that it should display the timeout error.

Any help would be appreciated.

Add custom destination name option.

Setting custom path is really useful, but the file has the name taken from the url passed, it should be useful to add a parameter to the downloader to add a custom filename to avoid the need to add custom code to the finish delegate method, e.g. using NSFileManager, to copy the downloaded file to a new file with a different name and delete the downloaded version.

MultiFile

how i can use this project to download multi file in the same time how to pass it to downloaded in parallel

Random AppCrash while downloading

Hi Thibault,

First, thanks for the lib, because downloading large files and do this properly, it's not very easy in ObjC.

Unfortunately, I have random crashs while downloading. Please find below, the error stack :

*** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM insertObject:atIndex:]: index 7 beyond bounds [0 .. 5]'
*** First throw call stack:
(
    0   CoreFoundation                      0x02a2a1e4 __exceptionPreprocess + 180
    1   libobjc.A.dylib                     0x027a98e5 objc_exception_throw + 44
    2   CoreFoundation                      0x029dcabc -[__NSArrayM insertObject:atIndex:] + 844
    3   CoreFoundation                      0x029dc760 -[__NSArrayM addObject:] + 64
    4   MyPRO                               0x000ba7da -[TCBlobDownloader updateTransferRate] + 378
    5   Foundation                          0x023dfde7 __NSFireTimer + 97
    6   CoreFoundation                      0x029e8ac6 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 22
    7   CoreFoundation                      0x029e84ad __CFRunLoopDoTimer + 1181
    8   CoreFoundation                      0x029d0538 __CFRunLoopRun + 1816
    9   CoreFoundation                      0x029cf9d3 CFRunLoopRunSpecific + 467
    10  CoreFoundation                      0x029cf7eb CFRunLoopRunInMode + 123
    11  Foundation                          0x02405e35 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 284
    12  Foundation                          0x023a1dc1 -[NSRunLoop(NSRunLoop) run] + 82
    13  MyPRO                               0x000b83f2 -[TCBlobDownloader start] + 2306
    14  Foundation                          0x0247ff44 __NSOQSchedule_f + 62
    15  libdispatch.dylib                   0x02dc04d0 _dispatch_client_callout + 14
    16  libdispatch.dylib                   0x02dacfe0 _dispatch_async_redirect_invoke + 202
    17  libdispatch.dylib                   0x02dc04d0 _dispatch_client_callout + 14
    18  libdispatch.dylib                   0x02daeeb7 _dispatch_root_queue_drain + 291
    19  libdispatch.dylib                   0x02daf127 _dispatch_worker_thread2 + 39
    20  libsystem_pthread.dylib             0x030efdab _pthread_wqthread + 336
    21  libsystem_pthread.dylib             0x030f3cce start_wqthread + 30
)
libc++abi.dylib: terminating with uncaught exception of type NSException

I also had the error HTTP 416, on one server, when i'm trying to download the same file from another server, it's fine... Bizarre ! :)

Thanks.

Nash.

multiple downloads with multiple previews

A tried to make an example with multiples downloads and multiples progress bars using blocks but it was not "funcional" as was using delegate.
By the way, I've implemented an stop/pause for an single item in queue, but to do that I had to change the your code a little.
Could you analise this changes an implement it if you want.
Check out my github.
https://github.com/alexandrenc/BlobExample
Sorry about the project name, theres an blackout of creativity.
P.S.: no not make pod install, or my changes in your code will be replaced.

Build for 64-bit

Go to TCBlobDownload Project's Target -> Build Settings -> Architectures, and select Standard architectures (including 64-bit) (armv7, armv7s, arm64) in the Architectures section. Otherwise, you can get the error messages like below:

Undefined symbols for architecture arm64:
  "_OBJC_CLASS_$_TCBlobDownloadManager", referenced from:
      objc-class-ref in SASandArtTableViewController.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Progress cannot recover when resume from previous task

Hi,
I use TCBlobDownload in my project to download mp3 files.I stop the downloading when the progress goes to about 50% then restart the task.It still start at 0%, I have checked the code, it seem supports the resuming function but the progress do not recover?

Error status Code 416

I can't download with url from a file of Google Drive. Can you help me ?
Error Domain=com.thibaultcha.tcblobdownload Code=1 "Erroneous HTTP status code 416 (requested range not satisfiable)" UserInfo={NSLocalizedDescription=Erroneous HTTP status code 416 (requested range not satisfiable), TCBlobDownloadErrorHTTPStatusKey=416}

Download Paused after downloaded around 60 files

The problem now I am facing is it's stopped responding after downloaded around 60 files. I am using TCBlobDownloader to download thousand of images. I have to restart the app to resume downloading. Again, it's stopped after downloaded around 60 files.

Only one download success when add urls in for loop

I have many files to downloa. Many of them are mp3 file with size 200KB500KB,and several video with size 10MB40MB. So I code like this :

for (......)
{
[[TCBlobDownloadManager sharedInstance] startDownloadWithURL:url customPath:downloadPath delegate:self];
}

But I find only one or two log printed out from download:didReceiveFirstResponse delegate. All other files all not download. Finaly, a friend told me to comment the code

//        self.speedTimer = [NSTimer scheduledTimerWithTimeInterval:1.0
//                                                           target:self
//                                                         selector:@selector(updateTransferRate)
//                                                         userInfo:nil
//                                                          repeats:YES];
//        [runLoop addTimer:self.speedTimer forMode:NSRunLoopCommonModes];

in method - (void)start in file TCBlobDownload, then download queue will be normal. I try and it indeed works. But I don't and stand why, so my friend too. May you explain this ?

how pause and resume a download

In my project i download mp3 in main view ,and i want to see progress in other view .how can i do .and i want pause and resume a download to that,is right?

Can't get callback from TCBlobDownloaderDelegate

I have use TCBlobDownloader to download file. But, I can't get callback from

  • (void)download:(TCBlobDownloader *)blobDownload didReceiveData:(uint64_t)received onTotal:(uint64_t)total.

Have I forgotten any thing?

TCBlobDownloadManager *sharedManager = [TCBlobDownloadManager sharedInstance];
TCBlobDownloader *downloader = [sharedManager startDownloadWithURL:url customPath:nil delegate:self];

Thank.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.