ios - Delegate not being set correctly -


im working on project , uiwebview class needs execute method downloadview class

i using open source project https://github.com/robertmryan/download-manager

when code executes method:

 downloadtableview *download = [[downloadtableview alloc] init];  [download queueandstartdownloads:_downloadurl]; 

this line doesnt set delegate right

  self.downloadmanager = [[downloadmanager alloc] initwithdelegate:self]; 

the whole start download method

- (void)queueandstartdownloads:(nsurl *)url {   nsstring *documentspath = nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes)[0]; nsstring *downloadfolder = [documentspath stringbyappendingpathcomponent:@"downloads"];  if ([[nsfilemanager defaultmanager] fileexistsatpath:downloadfolder])       //does file exist? {     if (![[nsfilemanager defaultmanager] createdirectoryatpath:downloadfolder                                    withintermediatedirectories:no                                                     attributes:nil                                                          error:nil]) {      } }  self.downloadmanager = [[downloadmanager alloc] initwithdelegate:self]; self.downloadmanager.maxconcurrentdownloads = 4;       nsstring *downloadfilename = [downloadfolder stringbyappendingpathcomponent:[url lastpathcomponent]];     [self.downloadmanager adddownloadwithfilename:downloadfilename url:url];   self.cancelbutton.enabled = yes; self.startdate = [nsdate date]; nslog(@"downling"); [self.downloadmanager start];  } 

the methods in downloadview class wont execute

 - (void)didfinishloadingallformanager:(downloadmanager *)downloadmanager 

{

assuming code under arc, code understand thatdownloadtableview *download local variable. hence downloadtableview object gets released after scope of method declared ends. hence delegate method doesn't called, because delegate released. avoid this, can create downloadtableview object instance variable.


Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -