首先需要通过终端 pod 导入
`NSURLSessionConfiguration*configuration = [NSURLSessionConfigurationdefaultSessionConfiguration];AFURLSessionManager *manager = [[AFURLSessionManageralloc]initWithSessionConfiguration:configuration];NSURL*URL = [NSURLURLWithString:@"http://example.com/download.zip"];NSURLRequest*request = [NSURLRequestrequestWithURL:URL];NSURLSessionDownloadTask*downloadTask = [managerdownloadTaskWithRequest:requestprogress:nildestination:^NSURL*(NSURL*targetPath,NSURLResponse*response) {NSURL*documentsDirectoryURL = [[NSFileManagerdefaultManager]URLForDirectory:NSDocumentDirectoryinDomain:NSUserDomainMaskappropriateForURL:nilcreate:NOerror:nil];return[documentsDirectoryURLURLByAppendingPathComponent:[responsesuggestedFilename]];}completionHandler:^(NSURLResponse*response,NSURL*filePath,NSError*error) {NSLog(@"File downloaded to:%@", filePath);}];[downloadTaskresume];`