当我运行xcodebuild
时,它会崩溃。它似乎没有编译测试目标的依赖,这是主要的应用程序。测试目标名为NiknikTests
,而应用程序的目标名为WTATest3
。
Ld build/UninstalledProducts/NiknikTests.xctest/NiknikTests normal i386
cd "/Users/ethen/.jenkins/workspace/Build NikNik"
export IPHONEOS_DEPLOYMENT_TARGET=7.1
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/Users/ethen/Desktop/sbt/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch i386 -bundle -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk -L/Users/ethen/.jenkins/workspace/Build\ NikNik/build/Release-iphonesimulator -L/Users/ethen/.jenkins/workspace/Build\ NikNik/NiknikTests/TestLibraries/include/lib -F/Users/ethen/.jenkins/workspace/Build\ NikNik/build/Release-iphonesimulator -F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk/Developer/Library/Frameworks -F/Applications/Xcode.app/Contents/Developer/Library/Frameworks -filelist /Users/ethen/.jenkins/workspace/Build\ NikNik/build/NikNik.build/Release-iphonesimulator/NiknikTests.build/Objects-normal/i386/NiknikTests.LinkFileList -bundle_loader /Users/ethen/.jenkins/workspace/Build\ NikNik/build/Release-iphonesimulator/Niknik.app/Niknik -Xlinker -objc_abi_version -Xlinker 2 -force_load /Users/ethen/.jenkins/workspace/Build\ NikNik/NiknikTests/TestLibraries/include/lib/libOCMock.a -ObjC -fobjc-arc -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=7.1 -framework UIKit -framework Foundation -Xlinker -dependency_info -Xlinker /Users/ethen/.jenkins/workspace/Build\ NikNik/build/NikNik.build/Release-iphonesimulator/NiknikTests.build/Objects-normal/i386/NiknikTests_dependency_info.dat -o /Users/ethen/.jenkins/workspace/Build\ NikNik/build/UninstalledProducts/NiknikTests.xctest/NiknikTests
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_NNBoundaryLineModel", referenced from:
objc-class-ref in NNBoundaryLineModelTests.o
(maybe you meant: _OBJC_CLASS_$_NNBoundaryLineModelTests)
"_OBJC_CLASS_$_NNConstant", referenced from:
objc-class-ref in NNConstantTests.o
(maybe you meant: _OBJC_CLASS_$_NNConstantTests)
"_OBJC_CLASS_$_NNPlayerModel", referenced from:
objc-class-ref in NNPlayerModelTests.o
(maybe you meant: _OBJC_CLASS_$_NNPlayerModelTests)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
这是我的xcodebuild
命令:
xcodebuild \
-target NiknikTests \
-arch i386 \
-configuration “Debug” \
-sdk iphonesimulator \
TARGETED_DEVICE_FAMILY="2" \
ONLY_ACTIVE_ARCH=NO \
clean install
当我从Xcode内部运行测试时,它运行正常。
编辑:这显示了NiknikTests
的目标依赖关系。
为什么不构建目标依赖项?
答案 0 :(得分:1)
由于arch i386存在一些问题,我看起来并没有构建目标依赖项。为了解决这个问题,我有两点建议:1)从xcodebuild命令中删除两个arch语句:
xcodebuild \
-target NiknikTests \
-configuration “Debug” \
-sdk iphonesimulator \
TARGETED_DEVICE_FAMILY="2" \
clean install
它应该自动为程序选择正确的架构。但是,如果这不起作用,2)尝试替换" -arch i386 \"用" ARCHS = i386 \" IE
xcodebuild \
-target NiknikTests \
ARCHS=i386 \
-configuration “Debug” \
-sdk iphonesimulator \
TARGETED_DEVICE_FAMILY="2" \
ONLY_ACTIVE_ARCH=NO \
clean install
答案 1 :(得分:1)
您是否尝试在构建方案下启用构建隐式依赖项?
我在使用Cocoapods和运行单元测试时遇到了类似的问题