Swift compiler error: “non-modular header inside f

2019-01-02 16:43发布

Now I would like to migrate my ObjC framework to Swift and I got the following error:

include of non-modular header inside framework module 'SOGraphDB'

The references is to a header file which just define a protocol and I use this header file in some classes to use this protocol.

Is seems related to the module feature but it is at the moment not quite clear how to fix, do you know a solution?

UPDATE:

This is a Swift compiler error.

UPDATE 2:

A quick fix (but not solving the root cause) is to set the following setting to yes: CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES

20条回答
泛滥B
2楼-- · 2019-01-02 17:46

In Swift:

1. Modify your Xcode project and targets' Build Settings as mentioned below:

Allow Non-modular Includes In Framework Modules: No

Enable Bitcode: Yes

2. Use the current latest version available for GoogleMaps iOS SDK (use CocoaPods for getting it):

GoogleMaps (1.10.4)

3. Comment the problematic import:

//import GoogleMaps

4. Create or modify your bridging header file, adding the problematic import:

[Your Xcode Project Name]-Bridging-Header.h

// Use this file to import your target's public headers 
// that you would like to expose to Swift.
#import <GoogleMaps/GoogleMaps.h>

5. Clean and re-build your Xcode project.

查看更多
何处买醉
3楼-- · 2019-01-02 17:47

I had this exact problem when including my own framework in a project. Fixed it by putting all imports of sqlite3.h in .m files not in public .h ones. I'm assuming that other libraries may flag similar issues with Xcode.

查看更多
登录 后发表回答