pmusolino / Wormholy

iOS network debugging, like a wizard 🧙‍♂️
MIT License
2.32k stars 184 forks source link

Can't compile with flag "use_modular_headers!" (CocoaPods) #7

Closed markuswinkler closed 5 years ago

markuswinkler commented 5 years ago

Hi!

Great idea!

If I use the flag "use_modular_headers!" in my pod file I get the following error: /Pods/Wormholy/Sources/Objc/Wormholy+Foo.m:9:9: 'Wormholy/Wormholy-Swift.h' file not found

I use the latest build for cocoapods directly from the repository. Wormholy is the only pod that gives me grief.

samnung commented 5 years ago

Workaround: change it to #import "Wormholy-Swift.h" and it will works.

markuswinkler commented 5 years ago

hm, that didn't work. same error. I also tried (with and without the workaround): pod 'Wormholy', :modular_headers => false, :configurations => ['Debug']

fawkeswei commented 5 years ago

Same here, workaround doesn't work

pmusolino commented 5 years ago

Hi guys, I will try to investigate the problem as soon as possible. Thanks for reporting the problem.

pmusolino commented 5 years ago

As reported by @VincentSit in this issue https://github.com/pmusolino/PMAlertController/issues/68#issuecomment-415459289 on my other project PMAlertController, the problem can not be solved.


Here is the answer for completeness:

Static libraries are completely different from dynamic frameworks, it is not a container or bundle.

A static library is a single file that contains classes, code and variables that were linked together by the library creator. It does not "contain" other files, it is essentially a database of compiled code.

Based on the above explanation, you can not use PMAlertController as a static library since you can not package xib file into static library.

use_modular_headers! is needed only if your Swift pod depends on an Objective-C pod. Detailed here. It doesn't make sense to use it here.

CocoaPods currently does not support mixing static libraries and dynamic frameworks in a project, and from their Issue, there is little likelihood of future support.

So I suggest you keep other pods as static libraries and package PMAlertController into a dynamic framework separately, used as an embedded framework. To do this, Carthage can help you.