gonzalezreal / Groot

From JSON to Core Data and back.
Other
534 stars 61 forks source link

CocoaPods: Include of non-modular header inside framework module 'Groot.Groot' #62

Closed coryell closed 8 years ago

coryell commented 8 years ago

Hello @gonzalezreal,

I'm having an issue building my Swift project after installing Groot 1.2 via CocoaPods 0.39.0.

Specifically, I get the following errors while trying to build Groot:

.../Pods/Groot/Groot/Groot.h .../Pods/Groot/Groot/Groot.h:31:9: Include of non-modular header inside framework module 'Groot.Groot' .../Pods/Groot/Groot/Groot.h:32:9: Include of non-modular header inside framework module 'Groot.Groot' .../Pods/Groot/Groot/Groot.h:33:9: Include of non-modular header inside framework module 'Groot.Groot' .../Pods/Groot/Groot/Groot.h:34:9: Include of non-modular header inside framework module 'Groot.Groot' Could not build Objective-C module 'Groot'

I took a look at this CocoaPods issue but this seems to be about importing header files from outside the Framework in question, whereas this issue is within the Framework.

My problem can be fixed by changing those lines from #import <Groot/$HEADER.h> to #import "$HEADER.h". Unfortunately, I don't know enough about Obj-C to know why, but I suspect that the former form makes Xcode think the header is outside of the framework.

I attempted another solution which was to change the Build Setting "Allow Non-modular Includes In Framework Modules" to Yes inside my Project, the Pods Project, the Groot target, and the Pods-$MYPROJECT target. This didn't solve the problem.

Thanks! Cutter

gonzalezreal commented 8 years ago

Hi, this is a Cocoapods issue. Please check #55 for possible workarounds.

kikolobo commented 8 years ago

As a reference, this is how I fixed it:

Added this in my Podfile's post_install section.

post_install do |installer|
    `find Pods -regex 'Pods/Groot.*\\.h' -print0 | xargs -0 sed -i '' 's/\\(<\\)Groot\\/\\(.*\\)\\(>\\)/\\"\\2\\"/'`
end
coryell commented 8 years ago

Hi @gonzalezreal and @kikolobo,

@kikolobo's fix also worked for me.

Regards, Cutter