3

I would like to use zipzap library in my swift ios project.

I use cocoapods to integrate it. When I run pod install everything works fine, but when I do import zipzap, it says Could not build Objective-C module 'zipzap'.

I've done everything that people recommend here and in similar questions. But no luck.

Is it possible that this library simply not compatible with swift-based projects?

This is my Podfile:

# Uncomment this line to define a global platform for your project
# platform :ios, '6.0'
source 'https://github.com/CocoaPods/Specs.git'
use_frameworks!

target 'MyProject-iOS' do
pod 'Reachability', '~> 3.2'
pod 'SwiftyJSON', '~> 2.1'
pod 'zipzap', '~> 8.0'
end

target 'MyProject-iOSTests' do

end
Community
  • 1
  • 1
Alex Smolov
  • 1,831
  • 4
  • 24
  • 43
  • 1
    do you get error on line including ? Cause that the issue I am facing. – Taha Samad Apr 29 '15 at 13:27
  • I'm having a similar error. I've tried using an objective-c bridging header to link the framework but am getting an error on ZZDataProvider.h on line "#include" – Unome May 09 '15 at 22:52

2 Answers2

4

I faced the same issue. Looks like the podspec for zipzap is missing. Due to which pod ends up making all header files public. And that is what causes the issue.

I wrote my own podspec file which only makes five headers public, rest are private. This decision was based on the podspec.json found in the zipzap repo.

I included zipzap in my project as follows:

pod 'zipzap', :podspec => 'https://raw.githubusercontent.com/tahasamad/zipzap/master/zipzap.podspec'

Taha Samad
  • 1,135
  • 1
  • 9
  • 22
  • I tried doing what you suggested but got the following: "[!] The platform of the target `Pods` (OS X 10.10) is not compatible with `zipzap (8.0.3)`, which does not support `osx`." I'm running mine on OSX, so the error makes sense, but when I kept pod 'zipzap': '~> 8.0.3" it ran, but then wouldn't let me import. – Unome May 09 '15 at 22:34
  • Strange -- the zipzap pod spec is definitely present but in JSON format. And the pod spec definitely only references the public headers: https://github.com/pixelglow/ZipZap/blob/master/ZipZap.podspec.json – Glen Low Jun 30 '15 at 02:46
4

I'm the author of ZipZap. Version 8.0.4 now properly supports iOS and OS X frameworks, both with and without CocoaPods. After updating with CocoaPods, you should just be able to import ZipZap in Swift and "it just works".

In order to get correct exception handling, you'll have to use CocoaPods 0.36 or later, otherwise you may get some build warnings.

Glen Low
  • 4,379
  • 1
  • 30
  • 36
  • I had to use "import zipzap" (all lowercase) instead of "import ZipZap" (uppercase Zs). Using CocoaPods 0.38.2 and ZipZap 8.0.4 – Danilo Carvalho Jul 27 '15 at 00:51