Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using @import in a CocoaPods project

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'
like image 763
Dov Avatar asked Dec 24 '14 17:12

Dov


People also ask

Can I use swift package manager with CocoaPods?

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.

Does CocoaPods support XCFramework?

Cocoapods too supports the distribution and consumption of XCFramework.


1 Answers

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:- enter image description here

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

like image 81
Hussain Shabbir Avatar answered Sep 28 '22 09:09

Hussain Shabbir