Search code examples
swiftcocoapodslintpodspecssziparchive

Lint a Swift cocoa pod with SSZipArchive dependency


Anyone had any luck creating a pod with a SSZipArchive dependency? My classes are all in Swift but I'm including my bridging file as well (#import "SSZipArchive"). When I try to lint I get 9 errors all related to SSZipArchive. Please let know your thoughts. Thanks so lot!

  • ERROR | SSZipArchive/SSZipArchive/minizip/ioapi.h:45:10: error: include of non-modular header inside framework module 'SSZipArchive.ioapi'
  • NOTE | Target Support Files/Pods-SSZipArchive/Pods-SSZipArchive-umbrella.h:5:9: note: in file included from Target Support Files/Pods-SSZipArchive/Pods-SSZipArchive-umbrella.h:5:
  • ERROR | SSZipArchive/SSZipArchive/minizip/mztools.h:15:10: error: include of non-modular header inside framework module 'SSZipArchive.mztools'
  • NOTE | SSZipArchive/SSZipArchive/minizip/mztools.h:18:10: note: in file included from SSZipArchive/SSZipArchive/minizip/mztools.h:18:
  • ERROR | SSZipArchive/SSZipArchive/minizip/unzip.h:51:10: error: include of non-modular header inside framework module 'SSZipArchive.unzip'
  • NOTE | Target Support Files/Pods-SSZipArchive/Pods-SSZipArchive-umbrella.h:7:9: note: in file included from Target Support Files/Pods-SSZipArchive/Pods-SSZipArchive-umbrella.h:7:
  • ERROR | SSZipArchive/SSZipArchive/minizip/zip.h:50:10: error: include of non-modular header inside framework module 'SSZipArchive.zip'
  • NOTE | Target Support Files/Pods-VideoPlayerLibrary/Pods-VideoPlayerLibrary-umbrella.h:3:9: note: in file included from Target Support Files/Pods-VideoPlayerLibrary/Pods-VideoPlayerLibrary-umbrella.h:3:
  • ERROR | VideoPlayerLibrary/Pod/Classes/VideoPlayerLibrary-Bridging-Header.h:12:9: error: could not build module 'SSZipArchive'
  • NOTE | :0: error: could not build Objective-C module 'VideoPlayerLibrary'

Here is my pod spec file:

Pod::Spec.new do |s|
  s.name                  = "VideoPlayerLibrary"
  s.version               = "1.0.27"
  s.platform              = :ios, "4.0"
  s.ios.deployment_target = "8.3"
  s.requires_arc          = true
  s.source_files          = 'Pod/Classes/*'
  s.resource_bundles      = {
    'VideoPlayerLibrary' => ['Pod/Assets/*']
  }
  s.library = 'zlib', 'z'
  s.frameworks = 'Foundation', 'UIKit'
  s.dependency 'Alamofire'
  s.dependency 'SSZipArchive'
end

Solution

  • I couldn't wait for a better solution, my temporary solution was to create a zipArchive class which talks to the SSZipArchive pod in objc. Not pretty and not ideal but works for now. I hope they update it soon.

    Note: you would import zipArchive.h in your bridging-header file and not SSZipArchive.h

    #import "zipArchive.h"
    #import <SSZipArchive/SSZipArchive.h>
    
    @implementation zipArchive
    
    + (BOOL)unzipFileAtPath:(NSString *)path toDestination:(NSString *)destination{
        return [SSZipArchive unzipFileAtPath:path toDestination:destination];
    }
    
    @end
    

    You also need to set "Allow Non-modular includes" in your project settings

    enter image description here