从 zip 文件无法从文档目录中获取数据

from the zip file not able to fetch data from the document directory

我正在下载一个 zip 文件并保存在文档目录中。然后使用 ssziparchive 进行解压缩。但没有从 zip 文件中获取任何数据。如何获取数据。而且我无法看到我的解压缩文件在哪里。在文档目录中只有我得到这个。

我已经使用此代码将 zip 解压缩为 zip 文件

NSString *documentsDirectory = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];

    NSString *fullPath = [documentsDirectory stringByAppendingPathComponent:@"image.zip"];
    NSString *zipPath =fullPath;
    NSString *destinationPath =[documentsDirectory  stringByAppendingPathComponent:@"unZipimage"];
    NSLog(@"zip path==%@",zipPath);
    NSLog(@"dest path==%@",destinationPath);
  //
    [SSZipArchive unzipFileAtPath:zipPath toDestination:destinationPath];

压缩包中的数据存储到文档目录如下。

  1. 从 Bundle 获取路径。

     NSString *StrZIP = [[NSBundle mainBundle] pathForResource:@"TestZIP" ofType:@"zip"];
    
  2. Zip转换为NSData

    NSData *ZIPData = [NSData dataWithContentsOfFile:StrZIP];
    
  3. 在文档目录中存储 Zip 文件

    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *documentsPath = [paths objectAtIndex:0]; //Get the docs directory
    NSString *filePath = [documentsPath stringByAppendingPathComponent:@"TestZIP.zip"]; //Add the file name
    [ZIPData writeToFile:filePath atomically:YES]; //Write the file
    
  4. TeztZIP 在 documentsPath

    使用 SSZipArchive 解压
    [SSZipArchive unzipFileAtPath:filePath toDestination:documentsPath];
    

输出: