XCode一直忘记导入的Frameworks [英] XCode keeps forgetting imported Frameworks

查看:83
本文介绍了XCode一直忘记导入的Frameworks的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有Xcode 6.3,使用Swift,像往常一样导入Parse 1.7.1 Framework(拖动,复制),然后将其设置为一个组:Frameworks。

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.

推荐答案

我今天刚刚用我的项目解决了同样的问题。我在一个快速的项目中导入了我的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.

apple docs

我通过引用Build Settings中的桥接头来修复它。

I fixed it by referencing the bridging header in Build Settings.


在Build Settings下,确保Swift Compiler下的Objective-C Bridging Header构建
设置 - 代码生成有一个
标头的路径。路径应该与您的项目相关,类似于在构建设置中指定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一直忘记导入的Frameworks的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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