简体   繁体   English

在objc / swift混合模块中,Xcode始终尝试包含模块本身

[英]In a mixed objc/swift module, Xcode always tries to include the module itself

This one is not easy to explain, but is also very annoying. 这不容易解释,但也很烦人。

I'm working on a Cocoapods framework (in development mode) with objc and swift sources. 我正在使用Cobapods框架(处于开发模式)使用objc和swift源。 Let's call it the " SuperCompoment " framework 我们称之为“ SuperCompoment ”框架

Xcode auto generates the SuperComponent-Swift.h file, to make Objc classes visible from Swift ones. Xcode自动生成SuperComponent-Swift.h文件,以使Objc类从Swift类中可见。
Some Objc classes also includes Swift classes. 一些Objc类还包括Swift类。

At compile time, in the SuperComponent-Swift.h , Xcode adds the line 在编译时,Xcode在SuperComponent-Swift.h添加以下行

#import <SuperComponent/SuperComponent.h>

... and fails to compile with the message: SuperComponent/SuperComponent.h file not found ...并且无法通过以下消息进行编译: SuperComponent/SuperComponent.h file not found

Xcode tries to include the framework inside the framework itself! Xcode试图将框架包含在框架本身中!

If I manually edit the auto-generated file by commenting the #import, the project compiles perfectly. 如果我通过注释#import手动编辑自动生成的文件,则项目可以完美编译。 But Xcode auto-generates the file after each clean and before archiving the project! 但是Xcode会在每次清理之后和归档项目之前自动生成文件!

Any clue? 有什么线索吗?

我不知道为什么Xcode会自动添加#import <SuperComponent/SuperComponent.h>行(因为它可以在没有它的情况下工作),但是如果我对他很好,可以在我的根目录添加一个空的SuperComponent.h文件框架,可以正常编译。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 公共swift类导入混合语言(ObjC + Swift)动态框架中的“私有”模块 - Public swift class import “private” module in mixed language(ObjC+Swift) dynamic framework 如何将 Swift package 中的 C++ 模块包含在另一个模块或 ZA3B5EBD8A1E88EBF43A1ZA72E 项目中 - How to include a C++ module from a Swift package, in another module or an Xcode project 在Swift中仅导入ObjC标头:无此类模块错误 - ObjC Header-Only Import in Swift: No Such Module error 在Swift&Objc混合应用中,Xcode无法找到Realm对多关系的协议 - In Swift&Objc mixed app Xcode cannot find protocol for Realm to-many relationship swift私有模块映射,尝试从框架中在Swift中使用objC代码 - swift private module map, trying to use objC code in Swift from within framework 导入自身后生成了错误的Module-Swift.h标头 - Wrong Module-Swift.h header is generated with import to itself 如何使用module.modulemap在Swift框架中导入objC框架? - How to use module.modulemap for importing objC framework inside swift framework? 在框架模块中包含非模块化标头-Xcode 9.2 - Include of non-modular header inside framework module - Xcode 9.2 在 objc 项目 xcode 11.3.1 中导入 swift 框架? - import swift framework in objc project xcode 11.3.1? 带有Xcode的Swift软件包管理器-无法构建Objective-C模块 - Swift Package Manager with Xcode - Could not build Objective-C module
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM