Leeleo3x
Leeleo3x

Reputation: 631

can't import embedded framework with xcode 6 GM

I added a framework target in my project. But when I attempt to import the framework, the compiler will return an error Use of '@import' when modules are disabled. I have already included the arm64 architecture in its Architectures build settings. And I can see the framework in Build Phases. I can import a framework in a new project instead of my current project. Is there any additional config I missed?

Upvotes: 43

Views: 22567

Answers (3)

Vladimir Ignatev
Vladimir Ignatev

Reputation: 2176

I have the same problem in Xcode 7. I have found the solution. It's to wrap Google Analytics into Cocoa Class (.m and .h), and use this wrapper from your .mm files. Also you should enable modules in Xcode.

For more information, please check my answer (and my Gist) here: https://stackoverflow.com/a/36267420/882187

I'm sorry, if it looks like I'm trying to spam, but I don't know how to re-link all those questions and answers better in one self-containing discussion thread.

Upvotes: 1

Manuel Escrig
Manuel Escrig

Reputation: 2835

For those that still have problems with enabling Modules.

The problem could be that the header file was imported into file.mm file (objective-c++), which is not supported to the @import module syntax.

Here is a good answer explaining other possible problems. https://stackoverflow.com/a/21921045/2269679

Upvotes: 38

Anil Varghese
Anil Varghese

Reputation: 42977

Use of '@import' when modules are disabled

Error msg says you are trying to use modules by @import when it is disabled. Goto build settings and enable modules or use #import instead.

enter image description here

Enable it by changing to YES

Upvotes: 102

Related Questions