gpt4 book ai didi

ios - Example-Swift.h 未找到

转载 作者:行者123 更新时间:2023-11-28 10:48:48 25 4
gpt4 key购买 nike

我正在开发一个混合了 Objective C 和 Swift 代码的 iOS 框架。构建在 #import "Example-Swift.h" 行失败,'Example-Swift.h' file not found

头文件确实生成了,我可以在以下位置找到它:

DerivedData/Example/Build/Products/Debug-iphonesimulator/Example.framework/Headers/Example-Swift.h

我尝试了 Stack Overflow 上所有被赞成的解决方案,但没有一个奏效。唯一的解决方法是在build设置中手动将目录添加到 User Header Search Paths

如果其他人不必手动添加 header 路径,我一定是做错了什么。此外,当此框架的用户将其作为 pod 包含时,他们还需要更新build设置,我真的很想避免这种情况。

那么,有没有一个不丑陋的解决方案?我正在使用 XCode 9.0.1。我希望 Xcode/iOS 有一个正常的构建系统...来自 Linux/Android,我喜欢 iOS 生态系统的很多东西,但构建系统太荒谬了。

最佳答案

我在混合的 Objective-C/Swift 框架中看到过这个问题,我的解决方案是将模块名称作为 include 的目录部分。在你的情况下是

#import "Example/Example-Swift.h"

代替

#import "Example-Swift.h"

这实际上记录在 Importing Code from Within the Same Framework TargetImporting Swift into Objective-C 小节中,地址为 https://developer.apple.com/library/content/documentation/Swift/Conceptual/BuildingCocoaApps/MixandMatch.html

关于ios - Example-Swift.h 未找到,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47146752/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com