Search code examples
iosswiftcocoapodsssziparchive

Installing SSZipArchive using cocoapods


I have tried to install SSZipArchive using Cocoapods, without success. I have several questions, and tried all solutions I found on StackOverflow to solve.

  1. Is Githut mandatory for installing this framework ? As told in the SSZipArchive webpage, I installed Cocoapods, dropped the SSZipArchive folder in the project and got no error after "pod install" within my project directory.
  2. After opening the workspace file, I still get a message that the frameworks can not be found. Framework names are in red. I tried to change the framework path ($(inherited), $SRCROOT, both recursive), without success
  3. Why isn't is JUST possible to compile the SSZipArchive.framework file and include it in the Libraries or in the project. Is it mandatory to use Cocoapods?

How to install SSZipArchive (or any other framework), without link error?


Solution

  • Try This.

    If you have already tried and fail to have proper file then do this, Remove line pod 'SSZipArchive' from Pod file and run "pod install", it will remove previously stored buggy files.

    Now your Pod file should be like below :

    # 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
    

    Run pod install

    open your project.xcworkspace, Where ever you want to use SSZiparchive methods.

    In Objective-C

    use "#import "ZipArchive.h"

    Then after you can use the class methods of SSZipArchive like this.

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

    In Swift

    import SSZipArchive
    

    Then after you can use class method like this

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