[英]Apple Mach-O Linker Error. Linker command failed with exit code 1
My App worked fine the last couple of days, but suddenly I get this error. 最近几天我的应用程序运行正常,但突然我收到了此错误消息。
I already tried these things: 我已经尝试过这些东西:
Here is the error: 这是错误:
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)
And here is one more warning 还有一个警告
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
Removing the Checkbox for the Test-Targets fixed the problem. 删除“测试目标”复选框可解决此问题。
If you run into this problem with Cocoapods during unit testing, you can just add pods to your testing target and run pod update
in the terminal. 如果您在单元测试期间遇到了Cocoapods的问题,则可以将Pod添加到测试目标中,然后在终端中运行
pod update
。 Here comes my example and it solves the problem: 这是我的示例,它可以解决问题:
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
After adding pods above, run pod update
. 在上面添加了
pod update
之后,运行pod update
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.