XCode keeps forgetting imported Frameworks(XCode 总是忘记导入的框架)
问题描述
我有 Xcode 6.3,使用 Swift,像往常一样导入 Parse 1.7.1 框架(拖动、复制),并将其设置在一个组中:框架.
I have Xcode 6.3, using Swift, importing a Parse 1.7.1 Framework as usual (dragging, copying) and I set it up in a group: Frameworks.
我编译了一段时间后一切正常,直到编译器不再识别这句话:
I compile and everything works fine for a while with it, until the compiler does not recognize this sentence anymore:
import Parse
它给了我错误:
No such module 'Parse'
一种解决方法是删除框架并再次复制它,但过了一段时间它开始变得烦人,我真的很想知道原因.
A workaround is to delete the Framework and copy it again, but after a while it starts getting annoying, and I would really like to know the cause.
我只同时编写代码和构建(偶尔创建新的 swift 文件),所以我无法解释为什么会发生这种情况.
I only code and build in the meantime (and occasionally creating new swift files), so I can't explain why this happens.
推荐答案
我今天刚刚在我的项目中解决了同样的问题.我在一个 swift 项目中导入了我的 obj-c 框架,它工作了一段时间,然后 xcode 似乎忘记了它,导致你遇到同样的错误.
I just fixed this same issue today with my project. I imported my obj-c framework in a swift project and it worked for a while, then xcode seemed to forget it causing the same error you have.
苹果文档
我通过在构建设置中引用桥接头来修复它.
I fixed it by referencing the bridging header in Build Settings.
在构建设置下,确保构建 Objective-C 桥接头Swift 编译器下的设置 - 代码生成有一个路径标题.路径应该相对于您的项目,类似于在 Build Settings 中指定 Info.plist 路径的方式.多数情况在这种情况下,您不需要修改此设置.
Under Build Settings, make sure the Objective-C Bridging Header build setting under Swift Compiler - Code Generation has a path to the header. The path should be relative to your project, similar to the way your Info.plist path is specified in Build Settings. In most cases, you should not need to modify this setting.
我刚刚在声明桥接头的字段中输入了桥接头文件夹名称/xxxx-BridgingHeader.h 的名称,一切都很好.
I just typed in the name of the bridging header folderName/xxxx-BridgingHeader.h in the field that states bridging header and all was well again.
这篇关于XCode 总是忘记导入的框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:XCode 总是忘记导入的框架


基础教程推荐
- Android ViewPager:在 ViewPager 中更新屏幕外但缓存的片段 2022-01-01
- 使用 Ryzen 处理器同时运行 WSL2 和 Android Studio 2022-01-01
- LocationClient 与 LocationManager 2022-01-01
- Android文本颜色不会改变颜色 2022-01-01
- 在 iOS 上默认是 char 签名还是 unsigned? 2022-01-01
- “让"到底是怎么回事?关键字在 Swift 中的作用? 2022-01-01
- 如何使用 YouTube API V3? 2022-01-01
- 固定小数的Android Money Input 2022-01-01
- :hover 状态不会在 iOS 上结束 2022-01-01
- 如何使 UINavigationBar 背景透明? 2022-01-01