ios 无法使用 xcode 6 GM 导入嵌入式框架

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/25883153/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 02:30:58  来源:igfitidea点击:

can't import embedded framework with xcode 6 GM

iosframeworksxcode6

提问by Leeleo3x

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?

我在我的项目中添加了一个框架目标。但是当我尝试导入框架时,编译器会返回一个错误Use of '@import' when modules are disabled。我已经在它的 Architectures 构建设置中包含了 arm64 架构。我可以在Build Phases 中看到框架。我可以在新项目中导入框架而不是当前项目。我错过了任何其他配置吗?

回答by Anil Varghese

Use of '@import' when modules are disabled

禁用模块时使用“@import”

Error msg says you are trying to use modulesby @importwhen it is disabled. Goto build settings and enable modulesor use #importinstead.

错误味精说你要使用modules@import,当它被禁用。转到构建设置并启用modules或使用#import

enter image description here

在此处输入图片说明

Enable it by changing to YES

通过更改为 YES 启用它

回答by Manuel Escrig

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.

问题可能是头文件被导入到 file.mm 文件(objective-c++)中,@import 模块语法不支持该文件。

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

这是一个很好的答案,解释了其他可能的问题。 https://stackoverflow.com/a/21921045/2269679

回答by Vladimir Ignatyev

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

我在 Xcode 7 中遇到了同样的问题。我找到了解决方案。它是将 Google Analytics 包装到 Cocoa Class(.m.h)中,并从您的.mm文件中使用此包装器。您还应该在 Xcode 中启用模块。

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

有关更多信息,请在此处查看我的答案(和我的要点):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.

对不起,如果我看起来像是在发送垃圾邮件,但我不知道如何在一个自包含的讨论线程中更好地重新链接所有这些问题和答案。