@import not working

I'm using Xcode Version 6.4 (6E35b) and am trying to switch over to using modules. I have enabled modules in the build settings of both my project and target. When I replace #import <UIKit/UIKit.h> with @import UIKit; in the pch file, I get a "use of '@import' when modules are disabled" error.


I've tried cleaning and rebuilding the project, but keep getting the error.


Am I missing anything?

So I completely removed my .pch file, and all #import <UIKit/UIKit.h> and #import <Foundation/Foundation.h> occurances and my project now builds fine.


I do need to include #import <CoreData/CoreData.h> to prevent build errors.

Correction: I still needed to add the @imports, since I forgot to remove the path to the pch file.

Were you aware that modules were designed to replace precompiled headers (pch)? That would explain why they didn't work well together.

Hi,


In general when seing the error "use of '@import' when modules are disabled" it means that at least one of the targets that included that header doesn't support Modules.

However, I agree that .pch file should be just removed. It is "replaced" with an umbrella header of the framework.

@import not working
 
 
Q