找不到xcode 6 pch.file

ale*_*ock 33 xcode objective-c xcode6

我将我的项目从xcode 5加载到xcode 6并看到错误myProject-prefix.pch在myProjectTests中找不到,我添加此文件并看到新的错误

Ld /Users/willrock/Library/Developer/Xcode/DerivedData/??????????_Extreme_Fitness-cdfxpafcwvsczkfjvlwznradvmhm/Build/Products/Debug-iphonesimulator/??????????\ Extreme\ FitnessTests.xctest/??????????\ Extreme\ FitnessTests normal x86_64
cd /Users/willrock/Desktop/ExtremeFitness
export IPHONEOS_DEPLOYMENT_TARGET=7.1
export 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 x86_64 -bundle -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.0.sdk -L/Users/willrock/Library/Developer/Xcode/DerivedData/??????????_Extreme_Fitness-cdfxpafcwvsczkfjvlwznradvmhm/Build/Products/Debug-iphonesimulator -F/Users/willrock/Library/Developer/Xcode/DerivedData/??????????_Extreme_Fitness-cdfxpafcwvsczkfjvlwznradvmhm/Build/Products/Debug-iphonesimulator -F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.0.sdk/Developer/Library/Frameworks -F/Applications/Xcode.app/Contents/Developer/Library/Frameworks -F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Frameworks -F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.0.sdk/Developer/Library/Frameworks -filelist /Users/willrock/Library/Developer/Xcode/DerivedData/??????????_Extreme_Fitness-cdfxpafcwvsczkfjvlwznradvmhm/Build/Intermediates/??????????\ Extreme\ Fitness.build/Debug-iphonesimulator/??????????\ Extreme\ FitnessTests.build/Objects-normal/x86_64/??????????\ Extreme\ FitnessTests.LinkFileList -bundle_loader /Users/willrock/Library/Developer/Xcode/DerivedData/??????????_Extreme_Fitness-cdfxpafcwvsczkfjvlwznradvmhm/Build/Products/Debug-iphonesimulator/extreme_fitness.app/extreme_fitness -Xlinker -objc_abi_version -Xlinker 2 -framework XCTest -fobjc-arc -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=7.1 -framework XCTest -framework UIKit -framework Foundation -Xlinker -dependency_info -Xlinker /Users/willrock/Library/Developer/Xcode/DerivedData/??????????_Extreme_Fitness-cdfxpafcwvsczkfjvlwznradvmhm/Build/Intermediates/??????????\ Extreme\ Fitness.build/Debug-iphonesimulator/??????????\ Extreme\ FitnessTests.build/Objects-normal/x86_64/??????????\ Extreme\ FitnessTests_dependency_info.dat -o /Users/willrock/Library/Developer/Xcode/DerivedData/??????????_Extreme_Fitness-cdfxpafcwvsczkfjvlwznradvmhm/Build/Products/Debug-iphonesimulator/??????????\ Extreme\ FitnessTests.xctest/??????????\ Extreme\ FitnessTests
Run Code Online (Sandbox Code Playgroud)

升d: file not found: /Users/willrock/Library/Developer/Xcode/DerivedData/??????????_Extreme_Fitness-cdfxpafcwvsczkfjvlwznradvmhm/Build/Products/Debug-iphonesimulator/extreme_fitness.app/extreme_fitness clang: error: linker command failed with exit code 1 (use -v to see invocation)

如果我加载项目请参阅xctest

clang: error: no such file or directory: '/Users/willrock/Desktop/ExtremeFitness/extreme_fitness/extreme_fitness-Prefix.pch' clang: error: no input files Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang failed with exit code 1

但在xcode 5中工作正常

emo*_*ity 107

  1. 制作新文件:⌘cmd+N
  2. iOS/Mac>其他> PCH文件> YourProject-Prefix.pch.
  3. 确保显示"全部"而不是"基本".(蓝色按钮)
  4. 项目>构建设置>搜索:"前缀标题".
  5. 在"Apple LLVM 7.0"下,您将获得Prefix Header密钥.
  6. 输入文件目录.例如:"$(SRCROOT)/ $(PROJECT_NAME)/ProjectName-Prefix.pch".
  7. 清洁项目:⌘cmd+ ⇧shift+K
  8. 建设项目:⌘cmd+B

前缀标题图像

  • 在第5步,我会输入`$(SRCROOT)/ $(PROJECT_NAME)/ YourProject-Prefix.pch`. (24认同)
  • 不需要"YourProjectName/YourProject-Prefix.pch".你可以直接指定.pch名称 (4认同)
  • Errrr ...它显然取决于文件的位置..没有普通人将文件保存在项目文件夹之外. (2认同)

ale*_*ock 17

我解决了它 - 在目标中删除xctest目标并编译

  • 这是一个虚假的解决方法,因为不解决问题,但从基数中删除它!如果我想添加回测试目标? (6认同)

Dee*_*pak 6

使用Xcode 6尝试此操作.您需要手动创建PCH文件.

文件 - >新建 - >文件 - > iOS - > C和C++ - > PCH文件.

将新的PCH文件添加到项目中 - 新文件>其他> PCH文件

在项目"Build Settings"选项中 - 将"Prefix Header"的值设置为PCH文件名,项目名称为前缀 - 即对于名为"TestProject"的项目和名为"MyPrefixHeaderFile"的PCH文件,添加值"TestProject" /MyPrefixHeaderFile.pch'到plist.


Imr*_*ran 5

这个问题有很多原因,我有自己的命中.我必须为我的项目运行两个步骤.可能对其他人有帮助.

  1. 我删除了Build Settings 的Prefix标题中的条目.

路径 - > Target> Build Settings > Prefix Header.

  1. 删除了目标中的您的项目测试文件.

    屏幕截图为第二点.

参考:http://www.buzztouch.com/forum/thread.php?tid = F42D8239A330C321132944A&currentPage = 3