使用 cocoapods 安装 SSZipArchive

Installing SSZipArchive using cocoapods

我尝试使用 Cocoapods 安装 SSZipArchive,但没有成功。我有几个问题,并尝试了我在 Whosebug 上找到的所有解决方案来解决。

  1. Githut 是否必须安装此框架?正如 SSZipArchive 网页中所述,我安装了 Cocoapods,将 SSZipArchive 文件夹放入项目中,并且在我的项目目录中 "pod install" 之后没有出现错误。
  2. 打开工作区文件后,我仍然收到一条消息,提示 找不到框架。框架名称为红色。我尝试更改框架路径($(继承),$SRCROOT,均递归),但没有成功
  3. 为什么不能编译 SSZipArchive.framework 文件并将其包含在库或项目中。是否必须使用 Cocoapods?

如何安装 SSZipArchive(或任何其他框架)而不出现 link 错误?

试试这个。

如果您已经尝试过但未能获得正确的文件,那么请执行此操作,从 Pod 文件中删除行 pod 'SSZipArchive' 和 运行 "pod install", 它将删除以前存储的错误文件。

现在您的 Pod 文件应该如下所示:

# Uncomment this line to define a global platform for your project
platform :ios, '8.0'
# Uncomment this line if you're using Swift
use_frameworks!

target 'ZIpArchive' do

pod 'SSZipArchive'

end

运行 pod install

打开你的project.xcworkspace,在任何你想使用 SSZiparchive 方法的地方。

Objective-C

使用"#import "ZipArchive.h"

然后就可以像这样使用SSZipArchive的class方法了

[SSZipArchive createZipFileAtPath:@"" withContentsOfDirectory:@"" withPassword:@""];

Swift

import SSZipArchive

然后你可以像这样使用class方法

SSZipArchive.createZipFileAtPath("", withContentsOfDirectory: "")

我所做的与@Wolverine 在他的评论中列出的完全相同,但 link 错误仍然出现,直到...

我在构建设置中将 $(inherited) 添加到 "Runpath Search Paths" 和 "Frameworks Search Paths"..