XCode 总是忘记导入的框架 [英] XCode keeps forgetting imported Frameworks

查看:13
本文介绍了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 总是忘记导入的框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆