Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c 为什么在Xcode 6.3中运行单元测试时构建失败?_Objective C_Xcode_Swift_Xcode6 - Fatal编程技术网

Objective c 为什么在Xcode 6.3中运行单元测试时构建失败?

Objective c 为什么在Xcode 6.3中运行单元测试时构建失败?,objective-c,xcode,swift,xcode6,Objective C,Xcode,Swift,Xcode6,当我尝试在Swift项目的Xcode中运行默认的单元测试时,构建失败了 import Cocoa import XCTest class Test2: XCTestCase { override func setUp() { super.setUp() // Put setup code here. This method is called before the invocation of each test method in the class. } override

当我尝试在Swift项目的Xcode中运行默认的单元测试时,构建失败了

import Cocoa
import XCTest

class Test2: XCTestCase {

override func setUp() {
    super.setUp()
    // Put setup code here. This method is called before the invocation of each test method in the class.
}

override func tearDown() {
    // Put teardown code here. This method is called after the invocation of each test method in the class.
    super.tearDown()
}

func testExample() {
    // This is an example of a functional test case.
    XCTAssert(true, "Pass")
}

func testPerformanceExample() {
    // This is an example of a performance test case.
    self.measureBlock() {
        // Put the code you want to measure the time of here.
    }
}
}

这发生在我自己的MBP和我的雇主提供的MBP上。我忍不住想这与项目设置有关

适用于Objective-C测试


非常感谢您的帮助,我已经拔出了剩下的一点点头发。

您不小心添加了一个OS X测试用例(您可以看到这一点,因为导入Cocoa)。这种情况有时会发生,因为Xcode选择了错误的源

向项目中添加测试时,请确保这些是iOS测试


这是一个iOS项目还是一个OS X项目?这是一个iOS项目。奇怪的是,我刚刚创建了一个空白的iOS项目,所有的单元测试都很好。所以我将重新创建我的项目,看看是否有效。谢谢!!这做得很好:)