【发布时间】:2012-06-22 09:36:32
【问题描述】:
我想知道如何从完成的 ASIHTTPRequest 中检索 post 值。
当我执行请求时,我会这样做:
[request setPostValue:uniqueID forKey:@"bookUniqueId"];
NSFileManager *fileManager = [[NSFileManager alloc]init];
if (![fileManager fileExistsAtPath:tempDir]) {
[fileManager createDirectoryAtPath:tempDir withIntermediateDirectories:YES attributes:nil error:nil];
}
[fileManager release];
tempDir = [[tempDir stringByAppendingPathComponent:uniqueID]stringByAppendingPathExtension:@"zip"];
[request setDownloadDestinationPath:tempDir];
[request setDelegate:self];
[request startAsynchronous];
因为我想下载 zip 文件,名称与我的书的 ID 相同。
在- (void)requestFinished:(ASIHTTPRequest *)request 方法中,我需要该ID 来解压缩文件。我无法将 ID 保存在 ivar 中,因为我想支持多个异步下载。
我该怎么做?有没有类似不存在的方法[request postValueForKey: key]的东西?
【问题讨论】:
-
请注意 ASIHTTPRequest 库已被弃用。我不会推荐它用于新项目。
标签: iphone objective-c ios ipad asihttprequest