XCTest.framework 构建错误 [英] XCTest.framework build error

查看:45
本文介绍了XCTest.framework 构建错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的应用程序中使用 DropBox Core API,因此,我必须包含 XCTest 框架,因为当我没有添加 XCTest 框架时,我的应用程序无法连接到 Dropbox,但是当我添加框架,在为模拟器构建时出现错误.我的代码没有任何问题!这是错误:

I am using the DropBox Core API in my app and therefore, I must include the XCTest framework, because, when I haven't added the XCTest framework, my app can't connect to dropbox, however when I do add the framework, I get an error while building for the simulator. There is nothing wrong with my code! Here is the error:

Ld /Users/Zach/Library/Developer/Xcode/DerivedData/SnapDrop!-fchnxyvnqyeefscfhmohrzxtiqeb/Build/Products/Debug-iphonesimulator/SnapDrop!.app/SnapDrop! normal i386
    cd "/Users/Zach/Desktop/SnapDrop!"
    setenv IPHONEOS_DEPLOYMENT_TARGET 6.1
    setenv PATH "/Applications/Xcode5-DP6.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode5-DP6.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Applications/Xcode5-DP6.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch i386 -isysroot /Applications/Xcode5-DP6.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.0.sdk -L/Users/Zach/Library/Developer/Xcode/DerivedData/SnapDrop!-fchnxyvnqyeefscfhmohrzxtiqeb/Build/Products/Debug-iphonesimulator -F/Users/Zach/Library/Developer/Xcode/DerivedData/SnapDrop!-fchnxyvnqyeefscfhmohrzxtiqeb/Build/Products/Debug-iphonesimulator -F/Users/Zach/Downloads/dropbox-ios-sdk-1.3.5 -F/Users/Zach/Downloads/dropbox-ios-sync-sdk-1-1.1.0 -F/Applications/Xcode5-DP6.app/Contents/Developer/Library/Frameworks -F/Users/Zach/Desktop -filelist /Users/Zach/Library/Developer/Xcode/DerivedData/SnapDrop!-fchnxyvnqyeefscfhmohrzxtiqeb/Build/Intermediates/SnapDrop!.build/Debug-iphonesimulator/SnapDrop!.build/Objects-normal/i386/SnapDrop!.LinkFileList -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=6.1 -framework iAd -framework AssetsLibrary -framework QuartzCore -framework SystemConfiguration -framework Security -framework CFNetwork -framework XCTest -framework Dropbox -framework DropboxSDK -framework CoreGraphics -framework UIKit -framework Foundation -Xlinker -dependency_info -Xlinker /Users/Zach/Library/Developer/Xcode/DerivedData/SnapDrop!-fchnxyvnqyeefscfhmohrzxtiqeb/Build/Intermediates/SnapDrop!.build/Debug-iphonesimulator/SnapDrop!.build/Objects-normal/i386/SnapDrop!_dependency_info.dat -o /Users/Zach/Library/Developer/Xcode/DerivedData/SnapDrop!-fchnxyvnqyeefscfhmohrzxtiqeb/Build/Products/Debug-iphonesimulator/SnapDrop!.app/SnapDrop!

ld: building for iOS Simulator, but linking against dylib built for MacOSX file '/Applications/Xcode5-DP6.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,但没有成功.

What should I do? If my framework is corrupt, can you tell me how to reinstall it? I have tried deleting and reinstalling Xcode with no luck.

推荐答案

我同意 Mike Weller 的观点.您可能不应该在您的实际应用程序代码中链接 XCTest 框架.删除 XCTest 框架.查看链接器错误并删除引用框架的内容.清洗,冲洗,重复.

I agree with Mike Weller. You should probably not be linking against the XCTest framework in your actual app code. Remove XCTest framework. Look at the linker errors and remove things that are referencing the framework. Wash, rinse, repeat.

如果你有一个测试目标,那就不同了.在从 SenTestKit 迁移到 XCTest 的过程中很容易发生的情况是框架搜索路径错误,这会导致链接到 Mac OS X 框架而不是 iOS 框架.这行不通.

If you have a test target, that is different. What can easily happen during the migration from SenTestKit to XCTest is having the wrong framework search path which causes linking against the Mac OS X framework instead of the iOS framework. This doesn't work.

查看正确的框架搜索路径设置的简单方法是创建一个虚拟项目,打开测试目标的构建设置,然后过滤框架搜索路径".

An easy way to see what the correct framework search path settings are is to create a dummy project, open the build settings for the Tests target and then filter for "Framework Search Path."

我认为正确的原版路径是:

I think the correct vanilla paths are:

$(SDKROOT)/Developer/Library/Frameworks     (non-recursive)
$(inherited)                                (non-recursive)
$(DEVELOPER_FRAMEWORKS_DIR)                 (non-recursive)

这篇关于XCTest.framework 构建错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆