在64位mac上运行使用arch = i386构建的xctest

时间:2014-02-11 21:14:35

标签: macos xctest

我有一个Mac应用程序,它是在64位Mac上使用i386架构构建的。最近我在Xcode项目中添加了测试用例(XCTest)来测试项目,当我使用Xcode启动测试时,一切正常。但是当我尝试在命令行上运行测试用例时,我得到的错误是抱怨构建测试的架构不匹配以及我正在运行的机器的不匹配。

/Applications/Xcode5.app/Contents/Developer/usr/bin/xctest -XCTest MyTests.xctest 2014-02-11 14:58:23.600 xctest[57952:707] The test bundle at /Users/myself/Library/Developer/Xcode/DerivedData/MyAppMac-elsbcgzhxehizognmveiiwsqvusx/Build/Products/Debug/MyTests.xctest could not be loaded because it is built for a different architecture than the currently-running test rig (which is running as x86_64). 2014-02-11 14:58:23.603 xctest[57953:203] *** NSTask: Task create for path '/Users/myself/Library/Developer/Xcode/DerivedData/MyAppMac-elsbcgzhxehizognmveiiwsqvusx/Build/Products/Debug/MyTests.xctest/Contents/MacOS/MyTests' failed: 22, "Invalid argument". Terminating temporary process.

测试用例也使用architecture = i386

构建

任何见解都会有所帮助,

由于

1 个答案:

答案 0 :(得分:0)

我最终使用xcodebuild命令运行单元测试,如下所示

xcodebuild test -scheme MyProjWithTests

有关xcodebuild here

的更多信息