基于 NSURLConnection 的 iOS 文件下载器。下载器将数据写入文件,而不是内存。
如何安装
使用 Cocoapods
pod 'MBFileDownloader'
或者只需将以下文件复制到您的项目中
MBFileDownloader.h MBFileDownloader.mm
如何使用
MBFileDownloader *fileDownloader = [[MBFileDownloader alloc] initWithURL:url toFilePath:filePath]; [fileDownloader downloadWithSuccess:^{ NSLog(@"success"); } update:^(float value) { NSLog(@"%f", value); } failure:^(NSError *error) { NSLog(@"%@", error); }];