I’m having an issue with accessing my downloaded file. I can see that
my downloaded data is coming through using the didReceiveData delegate
method but I never see the file in the directory once the request is
finished. Also, FWIW I’m requesting a .zip file from my bucket.
-(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];
}
Any help is greatly appreciated.
Ah found the problem.
First if you’re writing the data to disk using downloadDestinationPath you must remove the didReceiveData delegate method from your implementation. Also make sure you set your temporaryDownloadPath.