在Xcode 6中构建的旧项目中找不到XCTest / XCTest.h [英] XCTest/XCTest.h not found on old projects built in Xcode 6

查看:432
本文介绍了在Xcode 6中构建的旧项目中找不到XCTest / XCTest.h的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Xcode 6 Beta 2构建一些项目。这些项目都有某种类型的库使用XCTest(Kiwi / XCTest和Specta)而不是在Xcode 6中构建,因为XCTest / XCTest无法找到.h。

I have a few projects I'm trying to build with Xcode 6 Beta 2. The projects all have some type of library that uses XCTest (Kiwi/XCTest and Specta) that don't build in Xcode 6 because XCTest/XCTest.h cannot be found.

fatal error: 'XCTest/XCTest.h' file not found
#import <XCTest/XCTest.h>

我注意到XCTest.framework不再出现在带有二进制文件的链接库构建阶段列表中,但这很好,因为当我用Xcode 6创建一个 new 项目时,看起来库是自动链接的。

I noticed that XCTest.framework is no longer in the "Link Libraries with Binaries" build phase list, but that's fine because when I create a new project with Xcode 6 it appears the library is linked in automatically.

也许是一些相关性,我的需要XCTest的依赖项都是通过Cocoapods引入的。

Perhaps of some relevency, my XCTest-needing dependencies are all brought in via Cocoapods.

有什么我不知道我需要用我的项目更新吗?

Is there anything I'm unaware of that I need to update with my project?

推荐答案

注意:对于在Xcode 7中创建的任何项目,可能不需要这样做。

Note: This may not be needed for any projects created in Xcode 7.

CocoaPods修复了这个这里此处

CocoaPods had a fix for this here and here

为了解决这一问题对任何CocoaPod您需要在任何Pod targ中将以下内容添加到 FRAMEWORK_SEARCH_PATHS 的依赖项et需要XCTest(例如Kiwi,Specta,FBSnapshotTestCase等。

In order to fix this for any CocoaPod dependencies you need to add the following to FRAMEWORK_SEARCH_PATHS in any Pod target that requires XCTest (e.g. Kiwi, Specta, FBSnapshotTestCase, etc).

$(PLATFORM_DIR)/ Developer / Library / Frameworks

这将允许您在任何可能的依赖项中引用XCTest。这可以在CocoaPods的未来更新或您引用的Pod中修复,因此您可能希望稍后将其删除。

This will allow you to reference XCTest in any dependencies you may have. This may be fixed in a future update of CocoaPods, or the Pod you are referencing, so you may want to remove it later.

这对早期版本的Xcode应该可以安全使用。

It is not detrimental to earlier versions of Xcode so should be safe to use.

这篇关于在Xcode 6中构建的旧项目中找不到XCTest / XCTest.h的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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