"Using" @import "when modules are disabled" Error - Enable modules and Link Structures = YES

I have a project that uses CocoaPods and uses the SCLAlertView-Objective-C module. This module uses the import style of the @import UIKit; module @import UIKit; . I set "Enable Modules (C and Objective-C)" and "Automatically Link Frames" with YES in both my target and project settings. I still get the error "Using" @import "when modules are disabled."

Is there anything that could prevent Xcode from being able to enable Modules, such as using a .pch file, any linker flags, or something else that I haven't mentioned? I also tried to clear the project and the project creation folder. It had no effect.

It is also worth noting that my project has several goals, and also has the goal of deploying iOS 7.0. My base SDK is installed in iOS 8.3.

Screenshot of target build settings for modules

+7
module ios xcode cocoapods
source share
2 answers

I assume that your project contains XXX.mm files, however xcode only allows C and objective-c modules.

Please take a look at this answer for reference: Using @import in a C object in combination with __cplusplus

My solution is changing @import xxx to #import.

Good luck.

+6
source share

I just solved this in the main ObjC ++ project that I was working on to use Firebase.

Just create an ObjC ( .m ) file that contains the following.

 #import <Foundation/Foundation.h> @import Firebase; // << swap this for your specific import 

To do this, simply use #include in your .mm files for the specific headers you need. For me it meant:

 #include <"Firebase/Firebase.h"> #include <"FirebaseAuth/FirebaseAuth.h"> 

Just to emphasize this point, no error in the use of references had any meaning for this "Enable Modules (C & Objective-C)" already YES . Perhaps upgrading to Xcode7 did not help.

Hope this helps someone :)

+4
source share

All Articles