我在我的应用程序中使用了DropBox Core API,因此,我必须包括XCTest框架,因为当我没有添加XCTest框架时,我的应用程序无法连接到Dropbox,但是当我添加框架时,我在构建模拟器时出现错误。我的代码没有错!这是错误:
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时没有运气。
最佳答案
我同意Mike Weller的观点。您可能不应该在实际的应用程序代码中针对XCTest框架进行链接。删除XCTest框架。查看链接器错误,并删除引用框架的内容。洗涤,漂洗,重复。
如果您有一个测试目标,那就不一样了。从SenTestKit迁移到XCTest期间,很容易发生错误的框架搜索路径,从而导致与Mac OS X框架而不是iOS框架进行链接。这行不通。
查看正确的框架搜索路径设置的一种简单方法是创建一个虚拟项目,打开“测试”目标的构 build 置,然后过滤“框架搜索路径”。
我认为正确的 Vanilla 路径是:
$(SDKROOT)/Developer/Library/Frameworks (non-recursive)
$(inherited) (non-recursive)
$(DEVELOPER_FRAMEWORKS_DIR) (non-recursive)
关于iphone - XCTest.framework构建错误,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/18652963/