mixDownloadQueue.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. //
  2. // mixDownloadQueue.h
  3. // 双子星云手机
  4. //
  5. // Created by xd h on 2024/6/27.
  6. //
  7. #import <Foundation/Foundation.h>
  8. NS_ASSUME_NONNULL_BEGIN
  9. @interface mixDownloadQueue : NSObject
  10. /** 设置最大的并发下载个数 */
  11. @property (nonatomic, assign) NSInteger maxCount;
  12. @property (nonatomic,strong) NSURLSession *session;
  13. // 添加下载任务
  14. - (void)addDownloadWithSession:(NSURLSession *)session
  15. URL:(NSURL *)url
  16. begin:(void(^)(NSString * filePath))begin
  17. progress:(void(^)(NSInteger completeSize,NSInteger expectSize))progress
  18. complete:(void(^)(NSDictionary *respose,NSError *error))complet;
  19. - (void)startAllTasksWithSession:(NSURLSession *)session;
  20. // 供downloader 处理下载调用
  21. - (void)dataTask:(NSURLSessionDataTask *)dataTask didReceiveResponse:(NSURLResponse *)response;
  22. - (void)dataTask:(NSURLSessionDataTask *)dataTask didReceiveData:(NSData *)data;
  23. - (void)task:(NSURLSessionTask *)task didCompleteWithError:(NSError *)error;
  24. @end
  25. NS_ASSUME_NONNULL_END