如何解决ios7&;中的Mach-O-Linker错误;Xcode 5.0.1

如何解决ios7&;中的Mach-O-Linker错误;Xcode 5.0.1,ios,iphone,xcode,Ios,Iphone,Xcode,我无法为模拟器编译我的项目。 我收到Apple Mach-O-Linker错误。我不知道如何解决这些问题。我正在使用xcode 5.0.1。 请帮助我任何人。 提前谢谢 Ld /Users/murthych/Library/Developer/Xcode/DerivedData/ClassifiedDetails-elseirogpshyhmffphsiejgydphd/Build/Products/Debug-iphonesimulator/ClassifiedDetails.app/Clas

我无法为模拟器编译我的项目。
我收到Apple Mach-O-Linker错误。我不知道如何解决这些问题。我正在使用xcode 5.0.1。
请帮助我任何人。
提前谢谢

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错误消息

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) "

我建议您使用xcode 5.02稳定版本,然后希望这些Mac-O链接器错误能够得到解决。在安装xcode 5.02之前,我也面临同样的问题。

XTest。框架只需链接到项目中的单元测试目标。不应将其添加到UI应用程序目标

我发现在添加
xtest.framework
Xcode时,会向
框架搜索路径添加额外的
\

\"$(SDKROOT)/Developer/Library/Frameworks\"
\"$(DEVELOPER_LIBRARY_DIR)/Frameworks\"
$(DEVELOPER_FRAMEWORKS_DIR)

这会导致链接器问题

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)
要在XCode 5.1中解决此问题,请转到主项目窗口,选项卡生成设置->部分搜索路径->框架搜索路径,然后进行编辑以删除出现路径的
\


希望有帮助

删除测试目标并创建一个新的测试目标,然后在上面复制测试可以解决这个问题


如果您对此投反对票,请提供一个有效的理由,因为此提示对我有效。

您可以在不运行项目的情况下进行编译吗?是否包含仅支持iOS设备的静态库?你还可以确保包括所有必需的框架吗?请任何人帮助我。我对这一点感到惊讶…………我认为你没有粘贴整个消息。结尾应该有行写着“Mach-O-Linker错误:错误描述将在这里”。再次构建并发布实际的链接器错误,以便我们可以看到失败的地方。我收到了Mach-O-linker错误消息“为iOS模拟器构建,但针对MacOSX文件“/Applications/Xcode.app/Contents/Developer/Library/Frameworks/XCTest.framework/XCTest”为架构i386构建的dylib进行链接clang:错误:链接器命令失败,退出代码为1(使用-v查看调用)“链接器错误有一百种不同的原因,这些原因与XCode版本无关。虽然xCode的版本很可能是链接器错误的来源,但有很多其他合理的解释应该首先排除。这就是说,Irfan是对的,无论如何你都应该升级到5.0.2。这是错误的。我也用最新的Xcode 5.0.2解决了这个问题。检查我的答案以寻求解决办法。@Amar导致Mac-O链接器错误的原因不是一个,还有许多其他原因。在我的例子中,它是通过更新xcode解决的,在你的例子中,它是按照你在回答中提到的那样解决的。尽管如此,我仍然相信会有许多其他原因导致Mac-O链接器错误,正如ryan cumley在上面提到的那样。@Irfan
为iOS模拟器构建,但针对MacOSX文件“/Applications/Xcode.app/Contents/Developer/Library/Frameworks/xtest.framework”构建的动态库进行链接/‌​架构i386的xtest是一个原因。按照您的回答,升级到Xcode 5.0.2并没有帮助。我仍然可以复制它。@Amar是的,我同意你的回答。也许你能找出这个特定Mac-O链接器错误的确切问题,但我只是举一个Mac-O Liker错误的一般例子。arrrg!这已经让我在过去。我最近开始做一个老项目,它又发生了!我知道修复很容易,但只是忘记了它是什么。你真是天赐之物!!