iphone - Download Progress Status, when file is downloading from Google Drive? -


i able download files google drive, want know download progress. can 1 tell me how it?

i have tried downloading files:

nsstring *downloadurl = [[self.drivefiles objectatindex:indexpath.row] downloadurl]; gtmhttpfetcher *fetcher = [self.driveservice.fetcherservice fetcherwithurlstring:downloadurl]; filename=[[nsstring alloc] init]; [fetcher beginfetchwithcompletionhandler:^(nsdata *data, nserror *error)  {      gtldrivefile *file = [drivefiles objectatindex:indexpath.row];      nslog(@"\n\n\n\n\n");      nslog(@"this file size=====>%@",file.filesize);      nslog(@"this file name===>%@",file.title);       if(file.downloadurl!= nil)      {          if (data!=nil)          {              filename=file.title;               nsarray *paths =    nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes);              nsstring *documentsdirectory = [paths objectatindex:0];              documentsdirectory = [[paths   objectatindex:0]stringbyappendingpathcomponent:[nsstring stringwithformat:@"%@",filename]];              [data writetofile:documentsdirectory atomically:yes]; 

edit


i found simpler solution. there block used callbacks of progress:

gtmhttpfetcher *fetcher =     [self.driveservice.fetcherservice fetcherwithurlstring:downloadurl]; gtldrivefile *file = [drivefiles objectatindex:indexpath.row];  [fetcher setreceiveddatablock:^(nsdata *data) {     nslog(@"%f%% downloaded", (100.0 / [file.filesize longlongvalue] * [data length])); }]; 

Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -