objective c - iOS - NSURLSessionTask unzip file downloaded -


i have files download @ didfinishdownloadingtourl: , want unzip it. current code looks this:

- (void)urlsession:(nsurlsession *)session downloadtask:(nsurlsessiondownloadtask *)downloadtask didfinishdownloadingtourl:(nsurl *)location {     for(nsmutabledictionary *downloadinfo in downloadingarray)     {         if([[downloadinfo objectforkey:kmzdownloadkeytask] isequal:downloadtask])         {             if (location)             {                 nsstring *srcpath = location.absolutestring;                 nsstring *fullpathdst = [nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes) objectatindex:0];                  //unzip                 ziparchive *ziparchive = [[ziparchive alloc] init];                 [ziparchive unzipopenfile:srcpath password:@"pasword"];                 [ziparchive unzipfileto:fullpathdst overwrite:yes];                 [ziparchive unzipclosefile];                  nsfilemanager *filemanager = [nsfilemanager defaultmanager];                 nserror *error;                 nsarray *files = [filemanager contentsofdirectoryatpath:fullpathdst error:&error];                  nslog(@"files: %@", files);             }              break;         }     } } 

the files array empty. doing wrong?

you shouldn't use absolutestring, includes scheme (e.g. file://). use path method, instead.


Comments

Popular posts from this blog

javascript - How to get current YouTube IDs via iMacros? -

c# - Maintaining a program folder in program files out of date? -

emulation - Android map show my location didn't work -