Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

use of @import when modules are disabled

I have a problem

@import Foundation; 

and I see:
@import vs #import - iOS 7

and I set "Enable Modules" to "YES"

and my problem is not solved

like image 801
Ali Rezaei Avatar asked Apr 17 '15 14:04

Ali Rezaei


2 Answers

I got this warning in a zero-swift project whenever I tried to add the @import SafariServices; statement.

Solution: Enable the modules. Go to the Target > Build Settings and set the Enable Modules (C and Objective-C modules) to YES.

I've circled the Build Settings toggle to change.

OR

Note: I haven't verified this potential solution, but probably worthy of consideration if there are side effects caused by this solution.

Rather than enabling modules to entire project, we can enable modules for a specific file which is importing c++ file. Go to build phases -> Compile Sources -> Select the file -> Add compiler flag -fmodules

like image 132
Peter Brockmann Avatar answered Sep 22 '22 22:09

Peter Brockmann


The possible cause is that you use Objective-C++. Then modules get disabled despite the proper build settings.

like image 27
Aleks N. Avatar answered Sep 24 '22 22:09

Aleks N.