I cannot compile my project for the simulator .
I get Apple Mach-O-Linker error.I cant understand how to solve the issues.I am using xcode 5.0.1.
Please help me any body.
Thanks in advance.
Ld /Users/murthych/Library/Developer/Xcode/DerivedData/ClassifiedDetails-elseirogpshyhmffphsiejgydphd/Build/Products/Debug-iphonesimulator/ClassifiedDetails.app/ClassifiedDetails normal i386
cd /Users/murthych/Desktop/ClassifiedDetails
setenv IPHONEOS_DEPLOYMENT_TARGET 7.0
setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.0.sdk -L/Users/murthych/Library/Developer/Xcode/DerivedData/ClassifiedDetails-elseirogpshyhmffphsiejgydphd/Build/Products/Debug-iphonesimulator -F/Users/murthych/Library/Developer/Xcode/DerivedData/ClassifiedDetails-elseirogpshyhmffphsiejgydphd/Build/Products/Debug-iphonesimulator -F/Applications/Xcode.app/Contents/Developer/Library/Frameworks -filelist /Users/murthych/Library/Developer/Xcode/DerivedData/ClassifiedDetails-elseirogpshyhmffphsiejgydphd/Build/Intermediates/ClassifiedDetails.build/Debug-iphonesimulator/ClassifiedDetails.build/Objects-normal/i386/ClassifiedDetails.LinkFileList -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=7.0 -framework XCTest -framework CoreGraphics -framework UIKit -framework Foundation -Xlinker -dependency_info -Xlinker /Users/murthych/Library/Developer/Xcode/DerivedData/ClassifiedDetails-elseirogpshyhmffphsiejgydphd/Build/Intermediates/ClassifiedDetails.build/Debug-iphonesimulator/ClassifiedDetails.build/Objects-normal/i386/ClassifiedDetails_dependency_info.dat -o /Users/murthych/Library/Developer/Xcode/DerivedData/ClassifiedDetails-elseirogpshyhmffphsiejgydphd/Build/Products/Debug-iphonesimulator/ClassifiedDetails.app/ClassifiedDetails
Mach-O-Linker error message
building for iOS Simulator, but linking against dylib built for MacOSX file '/Applications/Xcode.app/Contents/Developer/Library/Frameworks/XCTest.framework/XCTest' for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see invocation) "
Deleting the test target and creating a new one and then copying the tests over can fix this.
If you down vote this please provide a valid reason because this hint worked for me.
XCTest.framework
needs to be linked only to the unit test target in your project. It should not be added to the UI application target.
What I have found is when adding XCTest.framework
Xcode adds extra \
to Framework Search Paths
\"$(SDKROOT)/Developer/Library/Frameworks\"
\"$(DEVELOPER_LIBRARY_DIR)/Frameworks\"
$(DEVELOPER_FRAMEWORKS_DIR)
This causes linker issue,
ld: building for iOS Simulator, but linking against dylib built for MacOSX file '/Applications/Xcode.app/Contents/Developer/Library/Frameworks/XCTest.framework/XCTest' for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
To resolve this issue in XCode 5.1 goto the main ProjectWindow, Tab Build Settings -> Section Search Path -> Framework Search Paths and edit to remove \
appearing the paths.
Hope that helps!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With