1
我在訪問我下載的文件時遇到問題。我可以看到 我下載的數據是通過使用didReceiveData委託 方法實現的,但一旦請求完成後,我就不會在目錄中看到該文件。另外,FWIW我正在從我的存儲桶申請一個.zip文件。ASIHTTPRequest(ASIS3ObjectRequest) - 文件未下載
-(void)downloadZipFile
{
ASIS3ObjectRequest *request = [ASIS3ObjectRequest
requestWithBucket:bucket key:keyPath];
[request setSecretAccessKey:secretAccessKey];
[request setAccessKey:accessKey];
[request setDelegate:self];
[request setDownloadDestinationPath:[[self documentsDirectory]
stringByAppendingPathComponent:@"test.zip"]];
[request startSynchronous];
}
- (void)requestFinished:(ASIHTTPRequest *)request
{
NSError *error;
NSFileManager *fileManager = [[NSFileManager alloc] init];
NSLog(@"Documents directory: %@", [fileManager
contentsOfDirectoryAtPath:[self documentsDirectory] error:&error]);
//logging the contents of my documents directory shows that the file I downloaded is not there
[fileManager release];
}
- (NSString *)documentsDirectory {
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
NSUserDomainMask, YES);
return [paths objectAtIndex:0];
}
任何幫助,非常感謝。