views:

92

answers:

0

hi,

I have a NSURLDownload object in one class file. What I want to do is a different class that calls it becoming its delegate so that the delegate calls such as - (void)download:(NSURLDownload *)download decideDestinationWithSuggestedFilename:(NSString *)filename gets called.

I call the NSURLDownload containing class like this:

[[Activation sharedInstance] startActivation:self];

It calls the action I want it to, but none of the delegates of NSURLDownload are called.

This is the action startActivation:

- (void)startActivation:(id)sender
{

    NSURLRequest *theRequest = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.test.com/test.html"]
            cachePolicy:NSURLRequestUseProtocolCachePolicy
           timeoutInterval:30.0];

    // Create the download with the request and start loading the data.
 theDownload = [[NSURLDownload alloc] initWithRequest:theRequest delegate:sender]; //the sender used to be self
 [theDownload setDeletesFileUponFailure:YES];
}

This doesn't work delegate - wise though, the other cass never becomes its delegate, no NSURLDownload delegates get called.

How can I fix this problem?

Thanks in advance