I have a header in a CocoaPods project I'm working on in Xcode 6, in which I have an @import Cocoa;
statement. It builds fine in its own project, but when I integrate it into the client app, I get the following error:
Use of '@import' when modules are disabled
I checked the CLANG_ENABLE_MODULES setting in every target of my client project, as well as every target in the Pods project, and every single one is set to YES
. What could be triggering this error. I can switch back to a #import
, which does fix it, but I'd like to understand why this is happening, since everything looks like it's configured properly.
I pushed my podspec (UnzipKit), but I also replaced the @import
statements with #import
to get it working. Also, I'm using Cocoapods 0.35.0. If you use this in your Podfile, it'll get you the @import
version.
pod 'UnzipKit', :git => 'https://github.com/abbeycode/UnzipKit.git', :commit => '38cd0225015a245b0d3167666b3f40d57f99147a'
Even though CocoaPods is very easy to use, adding dependencies to a project using the Swift Package Manager has become the easier option thanks to Xcode's improved support for the SPM. An added bonus is that you no longer rely on a third party dependency manager.
Cocoapods too supports the distribution and consumption of XCFramework.
Use of '@import' when modules are disabled
If you are using Xcode version6 then make sure that below two things should be enable inside Language Module settings. Refer the attached screenshot:-
If you are using Xcode version lower than 6, You will get error because the module only work with apple framework and you cannot use them in other framework or third party Apps. You can check here
For more details of this answer check this stackOverflow answer
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With