所以我试图下载这样的文件:
NSString *acsmFileName = @"urllink.acsm";
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:licenceURL]];
AFHTTPRequestOperation *downloader = [[AFHTTPRequestOperation alloc]initWithRequest:request];
NSString *path = [documentsPath stringByAppendingPathComponent:acsmFileName];
downloader.outputStream = [NSOutputStream outputStreamToFileAtPath:path append:NO];
[downloader setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
}];
可以看出,在下载文件之前我不得不提一下文件名。现在,该文件可能具有不同的扩展名,这是我在下载完成后评估扩展后确定的。
我有办法做到这一点吗?