I've been trying to get downloads with ASIHTTPRequest working, and so far I've made some progress, but selectors are giving me trouble.
I'm trying to download lists of files from several folders in a S3 bucket. When using synchronous requests, everything works fine, but it stops the app for a few seconds, so I want to use async requests to make the request work in the background. Here's the method that's crashing:
Code:
for (int i = 1; i <= numberOfFolders; i++) {
ASIS3BucketRequest *listRequest = [ASIS3BucketRequest requestWithBucket:bucket];
[listRequest setAccessKey:accessKey];
[listRequest setSecretAccessKey:secretAccessKey];
NSString *baseDirectory = @"mapTiles/batches";
NSString *pathToBatch = [NSString stringWithFormat:@"%@/Folder%i", baseDirectory, i];
[listRequest setPrefix:pathToBatch];
[listRequest setDelegate:self];
[listRequest setDidFinishSelector:@selector(finishedDownloadingTileList:)];
[listRequest setDidFailSelector:@selector(failedDownloadingTileList:)];
[listRequest startAsynchronous];
}
The two selectors right now do nothing but write "success" or "failure" in NSLog, but the app doesn't make it that far-- just crashes when I call startAsynchronous.
Any pointers for me? The ASI how-to's website got me to this point, but I'm not sure how to get past this. Thanks for any help!