Lint a Swift cocoa pod with SSZipArchive dependency

こ雲淡風輕ζ 提交于 2019-12-07 08:46:03

问题


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

回答1:


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




回答2:


I was able to get SSZipArchive to compile but it was not after looking at their swift example https://github.com/ZipArchive/ZipArchive and copying their implementation exactly which compiled and ran for me.

this was after no success doing the various existing suggestions I have searched for in swift

I ended up having to adjust framework source , copy linker files, flags, to get things to match and eventually compile. It was pretty tedious because there were quite a number of changes in my current pod and even in my project .



来源:https://stackoverflow.com/questions/30113240/lint-a-swift-cocoa-pod-with-ssziparchive-dependency

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!