xcode修改项目名后反复出现 clang error, 提示 ld: file not found .
并且该错误并不是出现在项目编译阶段,而是项目的Tests 的link阶段, 同时提示 xctest 出现错误,详细描述如下:
Ld /Users/iOSDev/Library/Developer/Xcode/DerivedData/iddn-apnitmxvcbgmcoczqswzexnvbxai/Build/Products/Debug-iphoneos/iddnTests.xctest/iddnTests normal arm64
cd /Users/iOSDev/dev/propertymanager
export IPHONEOS_DEPLOYMENT_TARGET=7.0
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.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 arm64 -bundle -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk -L/Users/iOSDev/Library/Developer/Xcode/DerivedData/iddn-apnitmxvcbgmcoczqswzexnvbxai/Build/Products/Debug-iphoneos -F/Users/iOSDev/Library/Developer/Xcode/DerivedData/iddn-apnitmxvcbgmcoczqswzexnvbxai/Build/Products/Debug-iphoneos -F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk/Developer/Library/Frameworks -F/Applications/Xcode.app/Contents/Developer/Library/Frameworks -F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Frameworks -F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk/Developer/Library/Frameworks -filelist /Users/iOSDev/Library/Developer/Xcode/DerivedData/iddn-apnitmxvcbgmcoczqswzexnvbxai/Build/Intermediates/iddn.build/Debug-iphoneos/iddnTests.build/Objects-normal/arm64/iddnTests.LinkFileList -dead_strip -bundle_loader /Users/iOSDev/Library/Developer/Xcode/DerivedData/iddn-apnitmxvcbgmcoczqswzexnvbxai/Build/Products/Debug-iphoneos/PMS.app/PMS -framework XCTest -fobjc-arc -fobjc-link-runtime -miphoneos-version-min=7.0 -framework XCTest -framework UIKit -framework Foundation -Xlinker -dependency_info -Xlinker /Users/iOSDev/Library/Developer/Xcode/DerivedData/iddn-apnitmxvcbgmcoczqswzexnvbxai/Build/Intermediates/iddn.build/Debug-iphoneos/iddnTests.build/Objects-normal/arm64/iddnTests_dependency_info.dat -o /Users/iOSDev/Library/Developer/Xcode/DerivedData/iddn-apnitmxvcbgmcoczqswzexnvbxai/Build/Products/Debug-iphoneos/iddnTests.xctest/iddnTests
ld: file not found: /Users/iOSDev/Library/Developer/Xcode/DerivedData/iddn-apnitmxvcbgmcoczqswzexnvbxai/Build/Products/Debug-iphoneos/PMS.app/PMS
clang: error: linker command failed with exit code 1 (use -v to see invocation)
则该错误导致的原因是,我们在修改项目名称后,并未自动修改test部分的链接设置。
解决该问题的方法是: 修改bundler loader setting.
菜单 project->Scheme->Edit Scheme. 取消test执行的操作。 这是最简单粗暴的方法。