0

所以我正在尝试下载这样的文件:

    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) {
    }];

可以看出,在下载文件之前我不得不提到文件名。现在,该文件可能具有不同的扩展名,这由我在下载完成后评估扩展名后确定。

我有办法做到这一点吗?

4

0 回答 0