我的应用程序在过去几天工作正常,但突然间我收到了这个错误。
我已经尝试过这些东西:
这是错误:
ld /Users/someuser/Library/Developer/Xcode/DerivedData/myapp-dohndrkqlwlrkeggboazluaanniz/Build/Products/Debug-iphonesimulator/sampleappTests.xctest/sampleappTests normal x86_64
cd /Users/someuser/Development/Workspaces/2015/ios/myapp
export IPHONEOS_DEPLOYMENT_TARGET=8.2
export PATH="/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode-beta.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch x86_64 -bundle -isysroot /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.3.sdk -L/Users/someuser/Library/Developer/Xcode/DerivedData/myapp-dohndrkqlwlrkeggboazluaanniz/Build/Products/Debug-iphonesimulator -F/Users/someuser/Library/Developer/Xcode/DerivedData/myapp-dohndrkqlwlrkeggboazluaanniz/Build/Products/Debug-iphonesimulator -F/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.3.sdk/Developer/Library/Frameworks -F/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Frameworks -F/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.3.sdk/Developer/Library/Frameworks -filelist /Users/someuser/Library/Developer/Xcode/DerivedData/myapp-dohndrkqlwlrkeggboazluaanniz/Build/Intermediates/sampleapp.build/Debug-iphonesimulator/sampleappTests.build/Objects-normal/x86_64/sampleappTests.LinkFileList -Xlinker -rpath -Xlinker @executable_path/Frameworks -Xlinker -rpath -Xlinker @loader_path/Frameworks -bundle_loader /Users/someuser/Library/Developer/Xcode/DerivedData/myapp-dohndrkqlwlrkeggboazluaanniz/Build/Products/Debug-iphonesimulator/myapp.app/myapp -Xlinker -objc_abi_version -Xlinker 2 -framework XCTest -L/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator -Xlinker -add_ast_path -Xlinker /Users/someuser/Library/Developer/Xcode/DerivedData/myapp-dohndrkqlwlrkeggboazluaanniz/Build/Intermediates/sampleapp.build/Debug-iphonesimulator/sampleappTests.build/Objects-normal/x86_64/sampleappTests.swiftmodule -mios-simulator-version-min=8.2 -Xlinker -dependency_info -Xlinker /Users/someuser/Library/Developer/Xcode/DerivedData/myapp-dohndrkqlwlrkeggboazluaanniz/Build/Intermediates/sampleapp.build/Debug-iphonesimulator/sampleappTests.build/Objects-normal/x86_64/sampleappTests_dependency_info.dat -o /Users/someuser/Library/Developer/Xcode/DerivedData/myapp-dohndrkqlwlrkeggboazluaanniz/Build/Products/Debug-iphonesimulator/sampleappTests.xctest/sampleappTests
ld: file not found: /Users/someuser/Library/Developer/Xcode/DerivedData/myapp-dohndrkqlwlrkeggboazluaanniz/Build/Products/Debug-iphonesimulator/myapp.app/myapp
clang: error: linker command failed with exit code 1 (use -v to see invocation)
这是另一个警告
ld: warning: linking against dylib not safe for use in application extensions: /Users/someuser/Library/Developer/Xcode/DerivedData/myapp-dsaagxaaoxqxgxcwdhubkhreboeb/Build/Products/Debug-iphonesimulator/Pods/Alamofire.framework/Alamofire
答案 0 :(得分:1)
删除测试目标的复选框可解决问题。
答案 1 :(得分:0)
如果您在单元测试期间遇到Cocoapods的这个问题,您只需将pod添加到测试目标并在终端中运行pod update
即可。这是我的例子,它解决了这个问题:
target 'YourProject' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for YourProject
pod 'RAMAnimatedTabBarController', '~> 2.0.13'
pod 'XLPagerTabStrip', '~> 7.0'
pod 'ZFRippleButton'
pod 'Alamofire', '~> 4.4'
pod 'SWXMLHash', '~> 4.0.0'
pod 'SQLite.swift', '~> 0.11.3'
pod 'DZNEmptyDataSet'
pod 'PKHUD', '~> 4.0'
target 'YourProjectTests' do
# inherit! :search_paths
# Pods for testing
pod 'RAMAnimatedTabBarController', '~> 2.0.13'
pod 'XLPagerTabStrip', '~> 7.0'
pod 'ZFRippleButton'
pod 'Alamofire', '~> 4.4'
pod 'SWXMLHash', '~> 4.0.0'
pod 'SQLite.swift', '~> 0.11.3'
pod 'DZNEmptyDataSet'
pod 'PKHUD', '~> 4.0'
end
target 'YourProjectUITests' do
inherit! :search_paths
# Pods for testing
end
end
在上面添加pod后,运行pod update
。