xcode 在派生数据中找不到 .app 文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15891469/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
.app file not found in Derived Data
提问by dwf
When trying to compile my project I am getting this error and am wondering if anyone knows how to fix it?
尝试编译我的项目时出现此错误,想知道是否有人知道如何修复它?
I've read every answer on SO and elsewhere on the internet pertaining to this kind of linker error. I've tried so many solutions, including the very popular --delete derived data in xcode, quit xcode completely, delete it again on the command line and then restart xcode-- still nothing. This started after I tried to attach a device to my computer (which I've since deleted from the organizer) that was a friends to try to run it on his iPad. I'm at my wits end and can't afford to waste anymore time on this. Any ideas on how to fix it?
我已经阅读了关于 SO 和互联网上其他地方关于这种链接器错误的所有答案。我尝试了很多解决方案,包括非常流行的--在xcode中删除派生数据,完全退出xcode,在命令行上再次删除它然后重新启动xcode--仍然没有。这是在我尝试将一个设备连接到我的计算机(我已经从组织者中删除)之后开始的,这是一个朋友尝试在他的 iPad 上运行它。我已经无能为力了,不能再浪费时间在这上面了。关于如何解决它的任何想法?
The app file in the Products folder is red.
Products 文件夹中的应用程序文件是红色的。
EDIT: More info: The actual app is not being built and put in the Library/Developer/{app}/Build/Product folder. I've tried reconnecting the device and adding the provision profile manually from the apple website, then trying to Build->Archive the app while the device is selected. I still get the error. I've tried changing from debug to release in the Schemes and doing all of that, I still get the error. I tried uninstalling xcode and reinstalling it, deleting the app completely off the computer (including the derived data) pulling back down from Git and I get the same error.
编辑:更多信息:实际的应用程序没有被构建并放在 Library/Developer/{app}/Build/Product 文件夹中。我尝试重新连接设备并从苹果网站手动添加配置文件,然后尝试在选择设备时构建->归档应用程序。我仍然收到错误。我已经尝试在 Schemes 中从调试更改为发布并执行所有这些操作,但我仍然收到错误消息。我尝试卸载 xcode 并重新安装它,从计算机上完全删除该应用程序(包括派生数据),然后从 Git 中拉回,我得到了同样的错误。
Ld /Users/mischabuckler/Library/Developer/Xcode/DerivedData/TRx-clxlusutxvcrlkddtqwtoxibcmhc/Build/Products/Debug-iphonesimulator/UnitTests.octest/UnitTests normal i386 ????cd /Users/mischabuckler/Desktop/Git/TRx ????setenv IPHONEOS_DEPLOYMENT_TARGET 6.1 ????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 -bundle -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.1.sdk -L/Users/mischabuckler/Library/Developer/Xcode/DerivedData/TRx-clxlusutxvcrlkddtqwtoxibcmhc/Build/Products/Debug-iphonesimulator -F/Users/mischabuckler/Library/Developer/Xcode/DerivedData/TRx-clxlusutxvcrlkddtqwtoxibcmhc/Build/Products/Debug-iphonesimulator -F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.1.sdk/Developer/Library/Frameworks -F/Applications/Xcode.app/Contents/Developer/Library/Frameworks -filelist /Users/mischabuckler/Library/Developer/Xcode/DerivedData/TRx-clxlusutxvcrlkddtqwtoxibcmhc/Build/Intermediates/TRx.build/Debug-iphonesimulator/UnitTests.build/Objects-normal/i386/UnitTests.LinkFileList -bundle_loader /Users/mischabuckler/Library/Developer/Xcode/DerivedData/TRx-clxlusutxvcrlkddtqwtoxibcmhc/Build/Products/Debug-iphonesimulator/TRx.app/TRx -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=6.1 -framework SenTestingKit -framework UIKit -framework Foundation -o /Users/mischabuckler/Library/Developer/Xcode/DerivedData/TRx-clxlusutxvcrlkddtqwtoxibcmhc/Build/Products/Debug-iphonesimulator/UnitTests.octest/UnitTests
ld: file not found: /Users/mischabuckler/Library/Developer/Xcode/DerivedData/TRx-clxlusutxvcrlkddtqwtoxibcmhc/Build/Products/Debug-iphonesimulator/TRx.app/TRx clang: error: linker command failed with exit code 1 (use -v to see invocation)
Ld /Users/mischabuckler/Library/Developer/Xcode/DerivedData/TRx-clxlusutxvcrlkddtqwtoxibcmhc/Build/Products/Debug-iphonesimulator/UnitTests.octest/UnitTests normal i386 ????cd /Users/mischabuckler/Desktop/Git/TRx ? ??setenv IPHONEOS_DEPLOYMENT_TARGET 6.1 ????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 -bundle -isysroot / Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.1。sdk -L/Users/mischabuckler/Library/Developer/Xcode/DerivedData/TRx-clxlusutxvcrlkddtqwtoxibcmhc/Build/Products/Debug-iphonesimulator -F/Users/mischabuckler/Library/Developer/Xcode/DerivedData/TRx-clxlusutxcwtoxribddcmddcm Debug-iphonesimulator -F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.1.sdk/Developer/Library/Frameworks -F/Applications/Xcode.app/Contents/Developer/库/框架 -filelist /Users/mischabuckler/Library/Developer/Xcode/DerivedData/TRx-clxlusutxvcrlkddtqwtoxibcmhc/Build/Intermediates/TRx.build/Debug-iphonesimulator/UnitTests.build/Objects-normal/i386/UnitTests.LinkFileList /bundle_loader用户/mischabuckler/Library/Developer/Xcode/DerivedData/TRx-clxlusutxvcrlkddtqwtoxibcmhc/Build/Products/Debug-iphonesimulator/TRx。app/TRx -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=6.1 -framework SenTestingKit -framework UIKit -framework Foundation -o /Users/mischabuckler/库/开发人员/Xcode/DerivedData/TRx-clxlusutxvcrlkddtqwtoxibcmhc/Build/Products/Debug-iphonesimulator/UnitTests.octest/UnitTests
ld:文件未找到:/Users/mischabuckler/Library/Developer/Xcode/DerivedData/TRx-clxlusutxvcrlkddtqwtoxibcmhc/Build/Products/Debug-iphonesimulator/TRx.app/TRx clang:错误:链接器命令失败,退出代码为 1(使用 - v 查看调用)
采纳答案by dwf
So for anyone else who finds this and is frustrated what I ended up doing was deleting the target dependencies for both my app and the unit tests and then building the app once, then re-adding them and building the app again, and it worked fine.
因此,对于发现此问题并感到沮丧的其他任何人,我最终做的是删除我的应用程序和单元测试的目标依赖项,然后构建应用程序一次,然后重新添加它们并再次构建应用程序,并且它运行良好.
回答by ninjaneer
This happens when you rename the main target, and the test target hasn't been updated. Check the build settings in the test target and make sure the paths are pointing to the new folders. For example, if you renamed the target SuperAwesome to just Super, your test target is expecting files in SuperAwesome.app/ folder when it should be updated to Super.app/
当您重命名主目标并且测试目标尚未更新时,就会发生这种情况。检查测试目标中的构建设置并确保路径指向新文件夹。例如,如果您将目标 SuperAwesome 重命名为 SuperAwesome,则您的测试目标需要 SuperAwesome.app/ 文件夹中的文件,而应将其更新为 Super.app/
回答by Matt Parkins
Ok, the clue, while difficult to spot, is that the message you posted above isn't one building your app, but your unit tests. It also mentions it at the top of your output window, but one doesn't expect that to change.
好的,线索虽然难以发现,但您上面发布的消息不是构建您的应用程序,而是您的单元测试。它还在输出窗口的顶部提到了它,但人们不希望它会改变。
You've possibly renamed your scheme, and in doing so the unit test is pointing to your real build or something else. Your app may well actually have built fine, but its your unit test target that fails.
您可能已经重命名了您的方案,这样做时,单元测试将指向您的真实构建或其他内容。您的应用程序实际上可能构建得很好,但它的单元测试目标失败了。
If the problem is that you've been renaming targets then in your UnitTest scheme, go to build settings and search for TEST, which should bring up the settings for TEST HOST. Make sure these values are pointing to whatever you want the test app to be called and not the main executable.
如果问题是您一直在重命名目标,那么在您的 UnitTest 方案中,转到构建设置并搜索 TEST,这应该会显示 TEST HOST 的设置。确保这些值指向您希望调用测试应用程序的任何内容,而不是主可执行文件。
For me it was just a case of appending "test" onto both the debug & release setting of my test target's TEST_HOST.
对我来说,这只是将“测试”附加到我的测试目标的 TEST_HOST 的调试和发布设置的一种情况。
It all builds for me now, though annoyingly it is actually building both targets - at least they both compile.
现在这一切都为我构建,尽管令人讨厌的是它实际上正在构建两个目标 - 至少它们都编译。
回答by Allan Macatingrao
Try duplicating the target, and run using the target's copy.
尝试复制目标,并使用目标的副本运行。
回答by WaleedAmmari
回答by Andy Dong
Go to Project -- > Build Settings --> Testing --> Test Host Remove all the paths in Test Host, and do a clean build.
转到项目 --> 构建设置 --> 测试 --> 测试主机 删除测试主机中的所有路径,并进行干净的构建。